akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ls(x) (x)<<1
#define rs(x) (x)<<1|1
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ll rt<<1
#define rr rt<<1|1
#define PI acos(-1)
#define MM int m=(l+r)>>1;
#define fu(i,r,t) for(int i=r;i<=t;i++)
#define fd(i,r,t) for(int i=r;i>=t;i--)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define endl '\n'
#define lcm(a,b) (a*b)/__gcd(a,b)
#define Case(i,ans) cout<<"Case "<<i<<": "<<ans<<endl;
#define cp(i,ans) printf("%.if",ans);
#define cpp(i,ans) cout<<setprecision(i)<<fixed<<ans<<endl;
#define ppb pop_back
#define ppf pop_front
#define pb push_back
#define pf push_front
#define pq priority_queue
#define lowbit(x) (x)&(-x)
#define all(V) V.begin(),V.end()
#define ms multiset
#define mod(x) (x+mo_num)%mo_num
#define vc vector
#define vct vector<int>
#define fa(i,V) for(auto i:V)
#define out(i) cout<<(i)<<endl;
#define fi first
#define se second
#define fun(i) fu(i,1,n)
#define fut(i) fu(i,1,t)
#define fum(i) fu(i,1,m)
#define ld long double
//#define P pair<int,int>
using namespace std;
const int INF=LLONG_MAX;
const int maxn=1e5+5;
const int mo_num=1e9+7;
int n,m,a[maxn],b[maxn],ans;
int f[maxn+5];
bool odd(int x)
{
    int num=0;
    while(x)
    {
        x/=10;
        num++;
    }
    return num%2;
}
int32_t main()
{
    IOS
    cin>>n;
    fu(i,1,maxn)
    {
        f[i]=f[i-1]+odd(i);
    }
    cout<<f[n];
    return 0;
}

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

using namespace std;

int main() {
  int N;
  cin >> N;
  int a = N / 100;
  int b = (N - a * 100) / 10;
  int c = (N - a * 100 - b * 10);
  cout << a + b + c << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] l = new int[n];
    int ans = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      l[cnt] = sc.nextInt();
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < i; j++) {
        for (int k = 0; k < j; k++) {
          if (l[i] == l[j])
            continue;
          if (l[j] == l[k])
            continue;
          if (l[k] == l[i])
            continue;
          int[] ll = { l[i], l[j], l[k] };
          Arrays.sort(ll);
          if (ll[2] < ll[1] + ll[0]) {
            ans++;
          }
        }
      }
    }
    System.out.println(ans);
    sc.close();
  }
}

Measured memory_bytes: 41484
while True:
    m,f,r = map(int, input().split(' '))
    if m == f == r == -1:
        break
    elif m == -1 or f == -1:
        print('F')
    elif m + f >= 80:
        print('A')
    elif 65 <= m + f < 80:
        print('B')
    elif 50 <= m + f < 65:
        print('C')
    elif 30 <= m + f < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    else:
        print('F')


Measured memory_bytes: 5592
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<iomanip>
#include <string>
#include <math.h>
using namespace std;

int main(){
    long long int n,k,ans=0;
    cin>>n>>k;
    for(int i=k+1;i<=n;i++){
        ans+=(i-k)*(n/i);
        if((n)%i-k>=0){
            ans+=(n)%i-k+1;
            if(k==0){
                ans--;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define N 107
#define INF 1000000000
using namespace std;

typedef long long ll;

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

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

    int ctr = 0;
    FOR(i, 0, s.size())
    {
        if ((i % 2 == 0 && s[i] == '0') || (i % 2 == 1 && s[i] == '1'))
            ctr++;
    }
    cout << (s.size() - ctr > ctr ? ctr : s.size() - ctr) << endl;
    return 0;
}

Measured memory_bytes: 512
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var small = input[1];
            var large = input[2];
            if(small > large)
            {
                var tmp = small;
                small = large;
                large = tmp;
            }
            var max = small;
            var min = small + large - input[0];
            if (min < 0) min = 0;
            Console.WriteLine($"{max} {min}");
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n) ; i++)
constexpr auto INF = 2147483647;
static const double EPS = pow(10,-10);
typedef long long ll;
static int COUNTER_CLOCKWISE = 1;
static int CLOCKWISE = -1;
static int ONLINE_BACK = 2;
static int ONLINE_FRONT = -2;
static int ON_SEGMENT = 0;




class Vector2{
  public:
  double x, y;
  Vector2(){}
  Vector2(double x, double y): x(x), y(y) {}

  Vector2 operator + (Vector2 v) {
    return Vector2(x + v.x , y + v.y);
  }
  Vector2 operator - (Vector2 v) {
    return Vector2(x - v.x , y - v.y);
  }

  Vector2 operator * (double d){
    return Vector2(d*x, d*y);
  }

  double norm(){
    return pow(x,2) + pow(y,2);
  }

  double abs(){
    return sqrt(norm());
  }

};

double dot(Vector2 a, Vector2 b){
  return a.x * b.x + a.y * b.y; 
}

double cross(Vector2 a, Vector2 b){
  return a.x * b.y - a.y*b.x;
}

Vector2 projection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 base = b - a;
  Vector2 hypo = p - a;
  double norm_base = pow(base.x,2) + pow(base.y,2);

  Vector2 x;
  x = a + base*(dot(hypo,base) / norm_base);
  return x;
}

Vector2 refrection(Vector2 a, Vector2 b, Vector2 p){
  Vector2 v, p_projection;
  p_projection = projection(a,b,p); 
  v = p_projection + (p_projection - p);
  return v;
}

int ccw(Vector2 a, Vector2 b, Vector2 p){
  Vector2 hypo = p - a;
  Vector2 base = b - a;
  if(cross(base,hypo) > EPS) return COUNTER_CLOCKWISE;
  if(cross(base,hypo) < -EPS) return CLOCKWISE;
  if(dot(base,hypo) < -EPS) return ONLINE_BACK;
  if(hypo.norm() > base.norm()) return ONLINE_FRONT;
  return ON_SEGMENT;
}

bool intersect(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  int t1, t2;
  t1 =ccw(a,b,p)*ccw(a,b,q);
  t2 =ccw(p,q,a)*ccw(p,q,b);
  if(t1 <= 0 && t2 <= 0) return true;
  else return false;
}

Vector2 crossPoint(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  Vector2 base, hypo_1, hypo_2, v;
  base = b-a;
  hypo_1 = p-a;
  hypo_2 = q-a;
  double d1 = abs(cross(base, hypo_1)); 
  double d2 = abs(cross(base, hypo_2));
  double ratio = d1/(d1+d2);
  v = p + (hypo_2 - hypo_1)*ratio;
  return v;
}

double distance(Vector2 a,Vector2 b,Vector2 p){
  if(dot(b-a, p-b) > 0) return (p-b).abs();
  if(dot(b-a, p-a) < 0) return (p-a).abs();
  return (p - projection(a,b,p)).abs();
}

double distance(Vector2 a,Vector2 b,Vector2 p,Vector2 q){
  if(intersect(a,b,p,q)) return 0;
  vector<double> d_arr(4) ;
  d_arr[0] = distance(a,b,p);
  d_arr[1] = distance(a,b,q);
  d_arr[2] = distance(p,q,a);
  d_arr[3] = distance(p,q,b);
  return min(min(d_arr[0],d_arr[1]),
             min(d_arr[2],d_arr[3]));
}




int main(){
  Vector2 a,b,p,q,v;
  int queri;
  cin >> queri;
  rep(i,queri){
    cin >> a.x >> a.y >> b.x >> b.y;
    cin >> p.x >> p.y >> q.x >> q.y;
    cout << fixed << setprecision(10);
    cout << distance(a,b,p,q) << endl;
  }
}


Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
int n,m,h,k,a[100005],b[100005],c[100005],d[100005],e[100005];
vector<pair<int,int> >x;
int main(){
	while(true){
		for(int i=0;i<100005;i++){a[i]=0;b[i]=0;c[i]=0;d[i]=0;}
		x.clear();
		cin>>n;if(n==0)break;cin>>m>>h>>k;
		for(int i=1;i<=n;i++){a[i]=i;cin>>b[i];}
		for(int i=0;i<m;i++){
			int p1,p2;cin>>p1>>p2;x.push_back(make_pair(p2,p1));
		}
		sort(x.begin(),x.end());
		for(int i=0;i<(int)x.size();i++){
			c[i]=a[x[i].second];d[i]=a[x[i].second+1];
			swap(a[x[i].second],a[x[i].second+1]);
		}
		int B=0;
		for(int i=1;i<=n;i++){e[a[i]]=b[i];if(a[i]<=k)B+=b[i];}
		int maxn=0;
		for(int i=0;i<m;i++){
			if(c[i]<=k && d[i]>k)maxn=min(maxn,e[d[i]]-e[c[i]]);
			if(c[i]>k && d[i]<=k)maxn=min(maxn,e[c[i]]-e[d[i]]);
		}
		cout<<B+maxn<<endl;
	}
	return 0;
}

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

const long long MOD = 1e9 + 7;

long long mulmod(long long a, long long b) {
	return (a * b) % MOD;
}

long long summod(long long a, long long b) {
	return (a + b) % MOD;
}

long long binpow(long long a, long long n) {
  long long res = 1;
  for(; n > 0; n >>= 1) {
    if (n & 1LL)
    	res = mulmod(res, a);
    a = mulmod(a, a);
  }
  return res;
}

long long inverse(long long a) {
  return binpow(a, MOD - 2);
}

const int N = 1e5 + 2;
long long a[N], cnt[N], fact[N];

long long c(int a, int b) {
	return mulmod(fact[b], inverse(mulmod(fact[a], fact[b - a])));
}

void solve() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
		cin >> a[i];

	fact[0] = 1;
	for (int i = 1; i <= n; i++)
		fact[i] = mulmod(fact[i - 1], i);

	for (int i = 1; i < n; i++) {
		cnt[i] = mulmod(c(i + 1, n), mulmod(fact[i], fact[n - i - 1]));
		cnt[i] = summod(cnt[i], cnt[i - 1]);
	}

	long long res = 0;
	for (int i = 1; i <= n; i++) {
		long long mul = fact[n];
		mul = summod(mul, cnt[i - 1]);
		mul = summod(mul, cnt[n - i]);
		res = summod(res, mulmod(a[i], mul));
	}

	cout << res;
}

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


Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    

    class Program
    {
        
        
        static void Main(string[] args)
        {
            
            while(true)
            {
                string[] input = Console.ReadLine().Split(' ');
                int num_item = int.Parse(input[0]);
                int all_money = int.Parse(input[1]);

                if(num_item == 0 && all_money == 0)
                {
                    break;
                }

                List<int> item_money = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();

                item_money.Sort();

                int max_cost = -1;

                for(int i = 0; i < num_item - 1; i++)
                {
                    int item1 = item_money[i];
                    for(int j = i + 1; j < num_item; j++)
                    {
                        int item2 = item_money[j];
                        int sum_cost = item1 + item2;
                        if(sum_cost <= all_money && max_cost < sum_cost)
                        {
                            max_cost = item1 + item2;
                        }
                    }
                }

                if(max_cost == -1)
                {
                    Console.WriteLine("NONE");
                }
                else
                {
                    Console.WriteLine(max_cost);
                }
                
            }
            
        }
    }
}


Measured memory_bytes: 16324
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;

// ------------------------------------------------------------------------------------------------

ll n, m, s, t;
vll dist;
vvll g;

void func() {
    cin >> n >> m;
    g.resize(3 * n + 1);
    dist.assign(3 * n + 1, -1);
    for (ll i = 0; i < m; i++) {
        ll u, v; cin >> u >> v;
        g[3 * u].push_back(3 * v - 1);
        g[3 * u - 1].push_back(3 * v - 2);
        g[3 * u - 2].push_back(3 * v);
    }
    cin >> s >> t;
    queue<ll> q;
    q.push(3 * s); dist[3 * s] = 0;
    while (!q.empty()) {
        ll u = q.front(); q.pop();
        if (u == 3 * t) {
            cout << dist[u] / 3 << endl;
            return;
        }
        for (ll v : g[u]) {
            if (dist[v] != -1) {
                continue;
            }
            dist[v] = dist[u] + 1;
            q.push(v);
        }
    }
    cout << -1 << endl;
}

int main() {
    fast_io; cout.precision(32);
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}


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

using namespace std;

#define IOS 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ld			long double
#define ll 			long long
#define ull			unsigned long long
#define si(a)			a.size()
#define pb			push_back
#define mp			make_pair
#define F			first
#define S			second
#define lb			lower_bound
#define ub			upper_bound
#define deb(x)			cout<<"#x "<<x<<"\n";
#define trace(x,y)		cout<<"#x "<<x<<" #y "<<y<<"\n";
#define cn			cout<<"\n";
#define mod			1000000007


bool SBF(const pair<int,int>& a, const pair<int,int>& b){return a.F < b.F;}

bool SBS(const pair<int,int>& a, const pair<int,int>& b){return a.S < b.S;}



ll power(ll x, ll y){
	ll res = 1;
	x = x%mod;
	while(y){
	 	
                if(y&1)res = (res*x)%mod;
		y = y >> 1;
		x = (x*x)%mod;
	}
	return res;
}
ll modInv(ll x){
	return power(x , mod - 2);
}


const int INF = 1e9;





void solve(){ 
     string s, t;
     cin >> s  >> t;
     
     int n = s.length();
     int m = t.length();
     ll ans = m;
     for(int i = 0 ;i <= n - m; i++){
	     int diff = 0;
	     for(int j = 0 ;j < m;j++){
		     if(t[j]  != s[i+j])diff++;
	     }
	     ans = min(ans,diff*1LL);
     }
     cout<<ans<<"\n";




}











int main(){

    solve();

}
















Measured memory_bytes: 3600
#include <bits/stdc++.h>
#ifdef DBG
#define dbg(...) {cerr<<"\033[96;1m";ostream& cout=cerr;__VA_ARGS__;\
(void)(cout);cerr<<"\033[0m";}
#else
#define dbg(...)
#endif
#define st first
#define nd second
#define flg(...) __LINE__, __PRETTY_FUNCTION__
#define mkp(...) make_pair(__VA_ARGS__)
#define prt(...) print(cout, __VA_ARGS__)
#define dprt(...) dbg(prt(__VA_ARGS__))
#define dmp(...) prt(#__VA_ARGS__, __VA_ARGS__)
#define ddmp(...) dbg(dmp(__VA_ARGS__))
#define all(...) begin(__VA_ARGS__), end(__VA_ARGS__)
using namespace std; using ll = long long;
template<typename... t>using V=vector<t...>;
template<typename t>void print(ostream& os, const t& a){os<<a<<'\n';}
template<typename t, typename... v>void print(ostream& os, const t& a,
v&&... b){os<<a<<' ';print(os, b...);}
template<typename t>void inp(t& a){cin >> a;}
template<typename t, typename... v>void inp(t& a, v&... b){cin >> a;inp(b...);}

constexpr int maxn = 2e5;

int n;
int tb[maxn];

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

    inp(n);
    for (int i = 0; i < n; ++i)
        inp(tb[i]);

    int lo = 0, hi = -1, msk = 0; ll res = 0;
    for (;lo < n; ++lo)
    {
        while (hi + 1 < n and (tb[hi + 1] & msk) == 0)
            msk += tb[hi + 1], ++hi;
        res += hi - lo + 1;
        msk -= tb[lo];
    }
    prt(res);
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define rep(i, n) for(int i=0;i<(int)(n);++i)
template <typename T> lint gcd(T a, T b) {return b?gcd(b, a%b):a;}
template <typename T> lint lcm(T a, T b) {return a * b / gcd(a, b);};
template <typename T> inline void chmin(T &a, const T& b){if(a>b)a=b;}
template <typename T> inline void chmax(T &a, const T& b){if(a<b)a=b;}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, a;
  cin >> h >> a;
  int cnt = 0;
  while (h > 0) {
    h -= a;
    cnt++;
  }
  cout << cnt << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long llint;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = 999999999;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c, ans;
    cin >> a >> b >> c;
    if(a==b)ans = c;
    if(b==c)ans = a;
    if(c==a)ans = b;

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var ac = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		var selected = new HashSet<int>();
		var count = 0;

		for(var i = 0; i < n; ++i) {
			if (ac[ac[i] - 1] == i + 1 && i < ac[i]) {
				++count;
			}
		}

		Console.WriteLine(count);

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 27376
#include<iostream>
#include<algorithm>
using namespace std;
int a[300010];
int b[300010];
int sum[300010];
int ans[300010];
int main(){
    int n;cin>>n;
    for(int i=1;i<=n;i++){
        int tmp;cin>>tmp;a[tmp]++;
    }
    int m=0;
    for(int i=1;i<=n;i++) if(a[i])b[++m]=a[i];
    sort(b+1,b+m+1);
    for(int i=1;i<=m;i++) sum[i]=sum[i-1]+b[i];
    b[m+1]=1e9;
    for(int i=1;i<=m;i++){
        int l=i+1,r=m+1;
        while(l<=r){
            int m1=l+r>>1;
            int tmp=sum[m1-1]/(m1-i);
            if(tmp<=b[m1]) ans[m+1-i]=tmp,r=m1-1;
            else l=m1+1;
        }
    }
    for(int i=1;i<=n;i++)cout<<ans[i]<<endl;
}

Measured memory_bytes: 5376
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int A = scan.nextInt();
		int B = scan.nextInt();

		if (A + B >= 10) {
			System.out.println("error");
		} else {
			System.out.println(A + B);
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


Measured memory_bytes: 27104
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using lint = long int;
using namespace std;

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

    if (b + c > a)
        cout << (c - (a - b));
    else
        cout << 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
int main(void)
{
    int a, b, c;
	
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);	
	if(a<b && b<c){

	    printf("Yes\n");
	}
	else{

	    printf("No\n");
	}
    return 0;
}
	
	
	

Measured memory_bytes: 1008
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int A[1];
int size=1;
int m=2;
#define N 101
#define mod 1000000007
#define f(i,n) for(int i=0;i<n;i++)
/*
bool prime(ll n){if(n==1)return false;for(ll i=2;i*i<=n;i++)if(n%i==0){return false;}return true;}
void prime_fact(int n){for(int i=2;i*i<=n;i++){int count=0;if(n%i==0){while(n%i==0)n/=i,count++;cout<<i<<"^"<<count<<" ";}}if(n>1)cout<<n<<"^1";}
ll power(ll base ,ll pow){ll res=1;while(pow>0){if(pow&1)res*=base,pow-=1;else base*=base,pow/=2;}return res;}
void prime_fact_seieve(int n){for(int i=2;i<=size;i++){if(A[i]==0)for(ll j=i;j<=size;j+=i)if(A[i]==0)A[j]=i;}while(n>2){cout<<A[n]<<"*";n/=A[n];}}
template <class X> X gcd(X a , X b) { return b==0?a: gcd( b, a%b); }
template <class X> X lcm(X a , X b) { return a/gcd(a,b) * b ; }
ll Ab[N][N],I[N][N];  // identity matrix and a matrix to store result
void multiply(ll I[][N],ll A[][N],int dim)
{   int res[dim+1][dim+1];
    for(int i=0;i<dim;i++)
    {  for(int j=0;j<dim;j++)
        {
           res[i][j]=0;
           for(int k=0;k<dim;k++)
           {  res[i][j]+=((I[i][k]%mod)*(A[k][j])%mod)%mod;}}}

        for(int i=0;i<dim;i++)
            for(int j=0;j<dim;j++)
                I[i][j]=res[i][j];}
void powerMat(ll A[][N],int dim,int n)
{   for(int i=0;i<dim;i++)
    for(int j=0;j<dim;j++)
    {if(i==j) I[i][j]=1;
     else     I[i][j]=0;}
     while(n>0)
     {
         if(n%2)
         multiply(I,A,dim),n--;
         else
         multiply(A,A,dim),n/=2;
     }
     for(int i=0;i<dim;i++)
         for(int j=0;j<dim;j++)
             A[i][j]=I[i][j];
}
void printMat(ll A[][N],int dim)
{
    for(int i=0;i<dim;i++)
    {for(int j=0;j<dim;j++)
        {
            cout<<A[i][j]<<" ";
        }cout<<"\n";}
}
// REMEMBER PREFIX SUM SUFFIX SUM OR GCD VERY INTERESTING QUESTIONS
ll power(ll base ,ll pow,ll mo){ll res=1;while(pow>0){if(pow&1)res=(res%mo*base%mo)%mo,pow-=1;else base=(base%mo*base%mo)%mo,pow/=2;}return res;}*/
bool Binary(vector<int> arr,int n,int ele,int b)
{  int l=0,r=n-1,m;
   while(l<=r)
   {
       m=l+(r-l)/2;
       if(arr[m]==ele)
       {arr[m]=b;return true;}
       else if(arr[m]>ele)
           r=m-1;
       else
           l=r+1;
   }
    return false;

}

int main()
{
    fast;
    int n,m;float sum=0;
    cin>>n>>m;
    int arr[n];
    f(i,n){cin>>arr[i];sum+=arr[i];}
    sum=sum/(4*m);
    //cout<<sum;
    int count=0;
    f(i,n)
    {
        if(arr[i]>=sum)
            count++;
    }
    if(count>=m)
        cout<<"Yes";
    else
        cout<<"No";

}


Measured memory_bytes: 3636
#include<cstdio>
#include<iostream>
#include<fstream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
#define Set(a) memset(a,0,sizeof(a))
#define F(i,a,b) for(register int i=a,i##end=b;i<=i##end;++i)
#define UF(i,a,b) for(register int i=a,i##end=b;i>=i##end;--i)
#define openf(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)
#define re register
#define ri re int
#define il inline
typedef long long ll;
typedef unsigned long long ull;
template<typename T> inline T rd(T& x)
{
	T f=1;x=0;char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(; isdigit(c);c=getchar()) x=(x<<3)+(x<<1)+(T)(c-'0');
	x*=f;
	return x;
}
ll rd(){ll x;rd(x);return x;}
inline int max(int a,int b){return a>b?a:b;}
inline int min(int a,int b){return a<b?a:b;}
const int inf=1<<30;

int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(true)
	{
		c-=b;
		if(c<=0) {puts("Yes");return 0;}
		a-=d;
		if(a<=0) {puts("No");return 0;}
	}
	return 0;
}

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

bool is_integer(double x) { return std::floor(x) == x; }

int ans(int num) {
  int count = 0;
  for (int i = 2; i <= sqrt(2 * num); i++) {
    for (int j = 2; j <= sqrt(2 * num); j++) {
      int k2 = 2 * num - i * i - j * j;
      if (k2 <= 0) continue;
      double k = sqrt(2 * num - i * i - j * j);
      if (is_integer(k) && 2 <= k && k <= sqrt(2 * num)) {
        if (2 + i <= j + k && 2 + j <= i + k && 2 + k <= i + j) count++;
      }
    }
  }
  return count;
}

int main() {
  int num;
  cin >> num;
  for (int i = 1; i <= num; i++) {
    cout << ans(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 3476
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
#include<functional>
using namespace std;
int p = 1000000007;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
#define Endl endl
#define veb vector<bool>
#define sq(a) (a)*(a)
int kai_size = 100001;
vel kai(kai_size, 1);
vel ink(kai_size, 1);
vel dist;
int RE() {
	vel v(3, 2);
	return v.at(4);
}
void dis(int mid1, vvel &way,vel &conect) {
	int n = way.size();
	dist[mid1] = 0;
	queue<int> q;
	q.push(mid1);
	while (!q.empty()) {
		int st = q.front(); 
		conect.push_back(st);
		q.pop();
		rep(i, way[st].size()) {
			int to = way[st][i];
			if (dist[to] == -1) { 
				dist[to] = dist[st] + 1;
				q.push(to);
			}
		}
	}
}
V<pin> ret(int n, int d1, int d2) {
	if (d1 % 4 != 0 and d2 % 4 != 0) {
		if (d1 % 4 != d2 % 4) {
			V<pin> ans(0);
			for (int i = 0; i * 2 < n; i++) {
				for (int j = 0; j * 2 < n; j++) {
					ans.push_back(mkp(2 * i, 2 * j));
				}
			}
			return ans;
		}
		if (d1 % 4 == 1) {
			V<pin> ans(0);
			for (int i = 0; i * 2 < n; i++) {
				for (int j = 0; j * 2 < n; j++) {
					ans.push_back(mkp(2 * i, 2 * j));
					if (i * 2 + 1 < n and j * 2 + 1 < n) {
						ans.push_back(mkp(2 * i + 1, 2 * j + 1));
					}
				}
			}
			return ans;
		}
		V<pin> ans(0);
		for (int i = 0; i * 2 < n; i++) {
			for (int j = 0; j< n; j++) {
				ans.push_back(mkp(2 * i, j));
			}
		}
		return ans;
	}
	if (d1 % 4 == 0 and d2 % 4 == 0) {
		V<pin> ans = ret((n + 1) / 2, d1/4, d2/4);
		int sz = ans.size();
		V<pin> r_ans;
		rep(i, sz) {
			pin ans1 = ans[i];
			ans1.first *= 2;
			ans1.second *= 2;
			r_ans.push_back(ans1);
			ans1.second++;
			r_ans.push_back(ans1);
			ans1.first++;
			r_ans.push_back(ans1);
			ans1.second--;
			r_ans.push_back(ans1);
		}
		return r_ans;
	}
	if (d1 % 4 == 0) { swap(d1, d2); }
	V<pin> ans = ret((n + 1) / 2, d2/4, d2/4);
	int sz = ans.size();
	V<pin> r_ans;
	if (d1 % 4 == 1) {
		rep(i, sz) {
			pin ans1 = ans[i];
			ans1.first *= 2;
			ans1.second *= 2;
			r_ans.push_back(ans1);
			ans1.second++;
			ans1.first++;
			r_ans.push_back(ans1);
		}
	}
	else {
		rep(i, sz) {
			pin ans1 = ans[i];
			ans1.first *= 2;
			ans1.second *= 2;
			r_ans.push_back(ans1);
			ans1.second++;
			r_ans.push_back(ans1);
		}
	}
	return r_ans;
}
signed main() {
	int n; cin >> n;
	int d1, d2; cin >> d1 >> d2;
	if (d1 % 4 == 3) { d1++; }
	if (d2 % 4 == 3) { d2++; }
	V<pin> ans = ret(2*n, d1, d2);
	int sz = ans.size();
	int count = 0;
	rep(i, sz) {
		pin co = ans[i];
		if (co.first < 2 * n and co.second < 2 * n and count<n*n) {
			cout << co.first << " " << co.second << endl;
			count++;
		}
	}
	return 0;
}

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

using i16 = std::int16_t;
using i32 = std::int32_t;
using i64 = std::int64_t;
using usize = std::size_t;
template<typename T>
using Vector = std::vector<T>;
using String = std::string;
template<typename T>
using UniquePointer = std::unique_ptr<T>;
using namespace std;

#define rep(i, max) for(usize i = 0; i < max; ++i)
#define loop while(true)

UniquePointer<String> readLine() {
    UniquePointer<String> line(new String());
    getline(cin, *line);
    return line;
}

template<typename T>
UniquePointer<Vector<T>> readVector(usize num) {
    UniquePointer<Vector<T>> list(new Vector<T>(num));
    rep(i, num) {
        cin >> (*list)[i];
    }
    return list;
}


template<typename T>
void writeLine(T arg) {
    cout << arg << endl;
}

template<typename T>
void write(T arg) {
    cout << arg << std::flush;
}

void program();

int main()
{
    ios::sync_with_stdio(false);
    program();
}

void program() {
    i32 n, x, t;
    cin >> n;
    cin >> x;
    cin >> t;
    readLine();
    writeLine((i32)(ceil((double)n / x) * t));
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repr(i, a, n) for (int i = n - 1; i >= a; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

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

  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, 0, n) cin >> p[i];
  sort(p.begin(), p.end());

  int ans = 0;
  rep(i, 0, k) ans += p[i];
  cout << ans << endl;
}


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

int main()
{
  int n, m, i, j;
  cin >> n >> m;
  int A[n][m], b[m], c[n];

  for(i=0;i<n;i++)
    c[i] = 0;

  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      cin >> A[i][j];

  for(i=0;i<m;i++)
    cin >> b[i];

  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      c[i] += A[i][j]*b[j];

  for(i=0;i<n;i++)
    cout << c[i] << endl;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
#define pb push_back
#define CLR(a) memset(a, 0, sizeof a)
#define SETDP(a) memset(a, -1, sizeof a)
#define SETINF(a) memset(a, 127, sizeof a)
using namespace std;
typedef long long ll;
typedef pair<int, int>pii;

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(0);
    int a, b, c;
    cin>>a>>b>>c;
    if(a+b>=c&&a<=c)cout<<"YES\n";
    else cout<<"NO\n";
    return 0;
}


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

int ans, n;

bool chk(int k) {
    int cnt = 0;
    while(k) {
        k /= 10;
        cnt++;
    }
    return cnt%2;
}

int main() {
    cin >> n;

    for(int i=1; i<=n; i++) {
        if(chk(i)) ans++;
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N = 1e5+5;
int n,m,d;char s[N],t[N];
int main(){
	n=gi();m=gi();d=__gcd(n,m);
	scanf("%s",s+1);scanf("%s",t+1);
	for (int i=1,j=1;i<=n;i+=n/d,j+=m/d)
		if (s[i]!=t[j]) return puts("-1"),0;
	printf("%lld\n",1ll*n*m/d);return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	
	int A,B,C;
	cin>>A>>B>>C;
	cout<<min(B/A,C)<<endl;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) {
        if (b == 1) cout << "Bob" << endl;
        else cout << "Alice" << endl;
    }
    else if (a < b) {
        if (a == 1) cout << "Alice" << endl;
        else cout << "Bob" << endl;
    }
    else cout << "Draw" << endl;
}   

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

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

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

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

    repeat (i, N.size() / 2) {
        if (N[i] != N[N.size() - 1 - i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

map<long long,long long> a;
long long b[200005]={0};

int main() {
    long long m,n,i,cnt=0;
    cin>>n;
    for(i=1;i<=n;i++){
        cin>>b[i];
        a[b[i]+i]++;
    }
    for(i=1;i<=n;i++){
        cnt+=a[i-b[i]];
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 27928
#include<iostream>
#include<cmath>
#include<cstdlib>

int main()
{
    int N;
  	int	num=0;
    int i=0;
    double x,y,z=0;
    double Distance,D=0;

    std::cin >> N >> D;
    double X[N],Y[N]={0};

    for(i=0; i<N; i++)
    {
        std::cin >> X[i] >> Y[i];
        x=X[i]*X[i];
        y=Y[i]*Y[i];
        Distance = std::sqrt(x+y);
        if( Distance <= D)
        {
            num++;
        }
        std::cout << std::endl;
    }
  
    std::cout << num;

    return 0;
}

Measured memory_bytes: 6844
using System;
using System.Collections.Generic;
using System.Linq;
					
public class Program
{
	public static void Main()
	{
		var split = Console.ReadLine().Split(' ');
		var n = int.Parse(split[0]);
		var m = int.Parse(split[1]);
		var list = new int[m];
		for(int i = 0;i<n;i++){
			foreach(var a in Console.ReadLine().Split(' ').Skip(1)){
				var a_i = int.Parse(a);
				list[a_i-1]++;
			}
		}
		var count = 0;
		foreach(var a in list){
			if(a==n)count++;
		}
		Console.WriteLine(count);
	}
}

Measured memory_bytes: 13268
#include <stdio.h>

int main(void) {
    int h, w;
    char a[100][100];
    //入力
    scanf("%d %d", &h, &w);
    for (int i = 0; i < h; i++) {
        scanf("%s", a[i]);
    }

    for (int i = 0; i < h; i++) {
        int flag = 0;
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') { flag = 1; }
        }
        if (!flag) {
            for (int l = i; l < h - 1; l++) {
                for (int j = 0; j < w; j++) {
                    a[l][j] = a[l + 1][j];
                }
            }
            h--;
            i--;
        }
    }
    for (int i = 0; i < w; i++) {
        int flag = 0;
        for (int j = 0; j < h; j++) {
            if (a[j][i] == '#') { flag = 1; }
        }
        if (!flag) {
            for (int l = i; l < w - 1; l++) {
                for (int j = 0; j < h; j++) {
                    a[j][l] = a[j][l + 1];
                }
            }
            i--;
            w--;
        }
    }

    //出力
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            printf("%c", a[i][j]);
        }
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
main(){
  int max,min,mid;
  int q1,q2,b,c1,c2;
  int aizumoney,sosomoney,sosonum;
  while(1){
    cin>>q1;
    if(q1==0)break;
    cin>>b>>c1>>c2>>q2;
    //会津地鶏二分探索
    min=0;
    max=q2;
    while(min<=max){
      mid=(max+min)/2;
      aizumoney=mid*c1;
      sosomoney=b-aizumoney;
      sosonum=sosomoney/c2;
      // cout<<min<<" "<<max<<" "<<mid<<" "<<aizumoney<<" "<<sosomoney<<" "<<sosonum<<endl;
      if(mid+sosonum>=q1&&mid>0&&sosonum>=0&&sosomoney>=0||mid<=0){
	//cout<<"OK"<<endl;
	min=mid+1;
      }
      else{
	//cout<<"NG"<<endl;
	max=mid-1;
      }
    }
    mid=(max+min)/2;
    aizumoney=mid*c1;
    sosomoney=b-aizumoney;
    sosonum=sosomoney/c2; 
    //cout<<min<<" "<<max<<" "<<mid<<" "<<aizumoney<<" "<<sosomoney<<" "<<sosonum<<endl;
    if(mid+sosonum>=q1&&mid>0&&sosonum>=0&&sosomoney>=0){
      cout<<mid<<" "<<sosonum<<endl;
    }
    else{
      cout<<"NA"<<endl;
    }
  }
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<bool> vb;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(0, min(b, d) - max(a, c)) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,m,tot,a[N];
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=m;i++) scanf("%d",&a[i]);
	for (int i=1;i<=m;i++) if (a[i]&1) tot++;
	if (tot>2) return puts("Impossible"),0;
	if (tot){
		bool flag=0;
		for (int i=1;i<m;i++){
			if (a[i]&1){
				if (flag) swap(a[i],a[m]);
				else flag=1,swap(a[i],a[1]);
			}
		}
	}
	if (m==1){
		if (a[1]==1){
			printf("1\n1\n1\n");
			return 0;
		}
		printf("%d\n",a[1]);printf("2\n");
		printf("1 %d\n",a[1]-1);
		return 0;
	}
    for (int i=1;i<=m;i++) printf("%d ",a[i]);puts("");
    if (a[m]==1) printf("%d\n",m-1);else printf("%d\n",m);
    printf("%d\n",a[1]+1);
	for (int i=2;i<m;i++) printf("%d ",a[i]);
	if (a[m]>1) printf("%d\n",a[m]-1);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main (){
char s[11];
int i,k=0,l=0,m=0,n=0;
scanf ("%s",s);
if (s[0]=='A'){
l++;
}
for (i=0;s[i]!=0;i++){
n++;
if (s[i] < 'z'+1 && s[i] > 'a'-1){
m++;
}
}
for (i=2;i<strlen(s)-1;i++){
if (s[i]=='C'){
k++;
}
}
if (k==1 && l==1 && m==n-2){
printf ("AC");
}
  else {
  printf ("WA");
  }
return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

int main(){
    int a[3010];
    int N;
    cin >> N;
    for (int i = 0; i < N; i++){
        cin >> a[i];
    }
    int sum = 0;
    for (int k = 0; k < N; k++){
        sum += a[k] -1;
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#092_C
n=int(input())
a=[0]+[int(j) for j in input().split()]+[0]
d1=[abs(a[i]-a[i+1]) for i in range(n+1)]
d2=[abs(a[i]-a[i+2]) for i in range(n)]
sum_all=sum(d1)
for i in range(n):
    print(sum_all-d1[i]-d1[i+1]+d2[i])

Measured memory_bytes: 16684
#include<stdio.h>
#define MAX 500000
#define BUMP 10000000000

int count = 0;
int L[MAX / 2 + 2], R[MAX / 2 + 2];

void marge(int A[], int left, int mid, int right){
    int n1 = mid - left;
    int n2 = right - mid;
    int i, j, m;
   
    for(i = 0; i < n1; i++) L[i] = A[left + i];
    for(i = 0; i < n2; i++) R[i] = A[mid + i];
    L[n1] = R[n2] = BUMP;
    for(i = 0, j = 0, m = left; m < right; m++){
        count++;
        if(L[i] <= R[j]){
            A[m] =L[i];
            i++;
        }else{
            A[m] = R[j];
            j++;
        }
    }
}

void margesort(int A[], int left, int right){
    if(left + 1 < right ){
        int mid = (right + left) / 2;
        margesort(A, left, mid);
        margesort(A, mid, right);
        marge(A, left, mid, right);
    }
}

int main(void){
    int A[MAX];
    int n, i;

    scanf("%d", &n);
    for(i = 0; i < n; i++){
        scanf("%d", &A[i]);
    }

    margesort(A, 0, n);

    for(i = 0; i < n - 1; i++){
        printf("%d ", A[i]);
    }
    printf("%d\n%d\n", A[i], count);
    return 0;
}



Measured memory_bytes: 5648
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
	long long x;
	cin>>x;
	long long y=x/11;
	long long z=x%11;
	long long aw = y*2;
	long long sum=0;
	long long aw1=0;
	int i=1;
	while (sum<z){
		if (i%2==0){
			sum+=5;
		}else{
			sum+=6;
		}
		i++;
		aw1++;
	}
	aw+=aw1;
	cout<<aw<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())
#define debug(x) std::cerr << (x) << std::endl;
#define roll(x) for (auto itr : x) { debug(itr); }


template <class T> inline void chmax(T &ans, T t) { if (t > ans) ans = t;}
template <class T> inline void chmin(T &ans, T t) { if (t < ans) ans = t;}


// 最大公約数を求める(ユークリッドの互除法).
ll gcd (ll x, ll y) {
  if (y > x) swap(x,y);
  if (y == 0) return x;
  return gcd(x%y,y);
}

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), r(n), l(n);
  rep(i,n) {
    scanf("%lld", &a[i]);
  }
  
  l[0] = a[0], r[n - 1] = a[n - 1];
  
  for (int i = 1; i < n; ++i) {
    l[i] = gcd(a[i], l[i - 1]); 
  }

  for (int i = n - 2; i >= 0; --i) {
    r[i] = gcd(a[i], r[i + 1]);
  }

  ll mmax = 1, tmp;
  for (int i = 0; i < n; ++i) {
    tmp = 0;
    if (i == 0) tmp = r[i + 1];
    else if (i == n - 1) tmp = l[i - 1];
    else {
      tmp = gcd(l[i - 1], r[i + 1]);
    }
    // debug(tmp);
    chmax(mmax, tmp);
  }

  cout << mmax << endl;
}


Measured memory_bytes: 2560
#include<iostream>
using namespace std;
int main(){
    while(1){
        int n,x,a;
        int count;
        cin>>n>>x;
        if(n==0 && x==0)break;
        count=0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                a=x-i-j;
                if(a<=n && a>j) count++;
            }
        }
        cout<<count<<endl;
    }
    return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1000000007;
 
int main() {
    ll n, x;
    cin >> n >> x;

    vector<ll> a(n);
    vector<vector<ll>> b(n, vector<ll>(n));  // b[k][i] : 魔法をk回使うとき色iのスライムを手に入れるのにかかる時間の最小値
    ll ans = 0;
    rep(i, n) {
        cin >> a[i];
        ans += a[i];
        b[0][i] = a[i];
    }

    for(int k = 1; k < n; k++) {

        rep(i, n) {

            if(i >= k) {
                b[k][i] = min(b[k-1][i], a[i-k]);
            }
            else {
                b[k][i] = min(b[k-1][i], a[n+i-k]);
            }

        }

        ll now = k*x;
        rep(i, n) {
            now += b[k][i];
        }

        ans = min(ans, now);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31616
#include <stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(a+b>c+d)puts("Left");
  if(a+b<c+d)puts("Right");
  if(a+b==c+d)puts("Balanced");
  return 0;
}

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

// sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ
// sst ツづ按づァツ　return 2
int f(string s)
{
	unsigned int count;
	for(count = 1; count < s.size(); count++){
		if(s.at(count-1) != s.at(count)) break;
	}
	return count;
}

int main()
{
	int n;
	string str;
	while(1){
		cin>>n; if(n == 0) break;
		cin>>str;
		for(int i = 0; i < n; i++){
			string ans;
			for(unsigned int j = 0; j < str.size();){
				char buf[1024];
				int len = f(str.substr(j));
				sprintf(buf, "%d%c", len, str.at(j));
				ans += buf;
				j += len;
			}
			str = ans;
		}
		cout<<str<<endl;
	}
}

Measured memory_bytes: 1080
#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 1000 * 1000 * 1000 + 7;

bool res() {
	int n, m;
	cin >> n >> m;
	if (!cin) return false;

	int sol = (n * (n - 1) + m * (m - 1)) / 2;
	cout << sol << '\n';

	return true;
}

int main() {
	while (res()) {}
	return 0;
}

Measured memory_bytes: 256
package main

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

func solve() {
	k := getInt()
	even, odd := k/2, (k+1)/2

	ans := even*odd
	fmt.Fprintln(wr, ans)
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 640
S=input()
a=int(S[:2])
b=int(S[2:])
if 0<a<=12 and b==0 or 0<a<=12 and b>12:
  print("MMYY")
elif 0<a<=12 and 0<b<=12:
  print("AMBIGUOUS")
elif 0<b<=12 and a==0 or 0<b<=12 and a>12:
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 9016
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>

using namespace std;

long long int n, t[100];

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

long long int solve(){
	long long int ans = t[0];
	for(int i = 1; i < n; i++){
		ans *= t[i] / gcd(ans, t[i]);
	}
	return ans;
}

int main(){
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> t[i];
	}
	
	cout << solve() << endl;
	
	return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    N, M, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    ans, j = 0, M
    a = [0]
    b = [0]
    for i in range(N):
        a.append(a[i]+A[i])                    
    for i in range(M):
        b.append(b[i]+B[i])
    for i in range(N+1):
        if a[i] > K:
            break
        else:
            while a[i] + b[j] > K:
                j -= 1
        ans = max(ans, i+j)
    print(ans)

Measured memory_bytes: 47476