akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a);i<(b);++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
#define INF 1000000000000000
#define MOD 1000000007
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a:A) cin >> a;} 

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

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

int H, W, K; cin >> H >> W >> K;
VS S(H); invec(S);

i64 mini = INF;
rep(bit, 0, 1<<(H-1)){
    bool gok = true;
    int N = 0;
    VI ord(H, 0);
    rep(i, 0, H-1){
        if (bit & (1<<i)) ord[i+1] = ord[i] + 1, ++N;
        else ord[i+1] = ord[i];
    }
    int add = 0;
    VI nums(N+1, 0);
    rep(w, 0, W){
        VI one(N+1, 0);
        bool ok = true;
        rep(h, 0, H){
            one[ord[h]] += S[h][w] - '0';
            nums[ord[h]] += S[h][w] - '0';
            if (one[ord[h]] > K) gok = false;
            if (nums[ord[h]] > K) ok = false;
        }
        if (!ok) ++add, nums = one;
    }
    if (gok) chmin(mini, N+add);
}
cout << mini << "\n";

return 0;
}
// コンテスト前はtemplate振り返り。
// 書いて考える．場合分け．情報整理．
// 問題文から考える。自分ができることから考える。
// 単純に分かる量から．愚直解を実装して研究．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP(小さい問題から大きな問題)
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性→二分探索。逆から考える。
// 存在判定：構成方法，入力の特徴
// 構築問題。極端解を試す。
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// コーナーケース。境界値。数表出力プログラム作る
// 実行エラー：vector添え字超え．0割り．



Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int X;
  scanf("%d",&X);
  long happy = 0;
  while (X >= 500)
  {
    X -= 500;
    happy += 1000;
  }
  while (X >= 5)
  {
    X -= 5;
    happy += 5;
  }
  printf("%ld",happy);
}

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

int main()
{
	cin>>k>>x;
	for(int i=x-k+1;i<x;i++)
	cout<<i<<" ";
	for(int i=x;i<=k+x-1;i++)
	cout<<i<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
deck,shuf = [],[]
while True:
	dec = str(input())
	if dec == "-":
		break
	deck.append(dec)
	m =int(input())
	h = []
	for i in range(m):
		h.append(int(input()))
	shuf.append(h.copy())
for k in range(len(deck)):
	for kk in range(len(shuf[k])):
		deck[k] = deck[k][shuf[k][kk]:] + deck[k][:shuf[k][kk]]
	print(deck[k])


Measured memory_bytes: 5596
h,n = map(int,input().split())
P = []
M = []

for i in range(n):
    p,m = map(int,input().split())  
    P.append(p)
    M.append(m)
    
dp=[[999999999]*(h+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for j in range(h+1):
        dp[i+1][j] = min(dp[i+1][j],dp[i][j])
        dp[i+1][min(j+P[i],h)] = min(dp[i+1][min(j+P[i],h)],dp[i+1][j] + M[i] )
 
print(dp[n][h])

Measured memory_bytes: 147372
#include<iostream>
using namespace std;
int main(){
   
    int i;
    int num;
    cin >> num;
    int n[num];
    for(i=0;i<num;i++) cin >> n[i];
    cout << n[num-1];
    for(i=1;i<num;i++) cout <<" "<< n[num-i-1];
    cout << endl;
    return 0;
}



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

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

    for (int i = 1; i <= 10; i++) {
        if (1000 * i >= n) {
            cout << 1000 * i - n << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3644
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			Map<Integer, Integer> oddMap = new HashMap<>(), evenMap = new HashMap<>();
			IntStream.range(0, n).forEach(i -> {
				int v = scanner.nextInt();
				if (0 == (i & 1)) {
					evenMap.put(v, evenMap.getOrDefault(v, 0) + 1);
				} else {
					oddMap.put(v, oddMap.getOrDefault(v, 0) + 1);
				}
			});
			Entry<Integer, Integer> evenMax = evenMap.entrySet().stream()
					.max((x, y) -> Integer.compare(x.getValue(), y.getValue())).get();
			Entry<Integer, Integer> oddMax = oddMap.entrySet().stream()
					.max((x, y) -> Integer.compare(x.getValue(), y.getValue())).get();
			if (evenMax.getKey().equals(oddMax.getKey())) {
				// 最大値の数字が同じ場合、どちらかを削除する
				int evenSecond = evenMap.values().stream().sorted((x, y) -> Integer.compare(y, x))
						.mapToInt(Integer::intValue).skip(1).limit(1).sum();
				int oddSecond = oddMap.values().stream().sorted((x, y) -> Integer.compare(y, x))
						.mapToInt(Integer::intValue).skip(1).limit(1).sum();
				System.out.println(n - Math.max(evenMax.getValue() + oddSecond, oddMax.getValue() + evenSecond));
			} else {
				System.out.println(n - evenMax.getValue() - oddMax.getValue());
			}
		}
	}
}


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

#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384


int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;} 
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}    //最大公約数
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}     //最小公倍数
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;} //コンビネーション
int nHr(int a,int b){return nCr(a+b-1,b);}       // 重複組み合わせ
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}  //階乗
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;} // a~bまでの階乗
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}   //数字の各位の和
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}  // b進数の各位の和？
int sankaku(int x){return ((1+x)*x)/2;} //三角数 xまでの和

//以下long long ver
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llnHr(long long a,long long b){return llnCr(a+b-1,b);}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long lldsum(long long x){long long r=0;while(x){r+=(x%10);x/=10;}return r;}
long long lldsumb(long long x,long long b){long long r=0;while(x){r+=(x%b);x/=b;}return r;}
long long llsankaku(long long x){return ((1+x)*x)/2;}

//double
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}


typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;
 
/*CODE START HERE*/
int main() {
  int  n,m;
  cin >> n >> m;
  vii s(n);
  vii ch(m) ;
  for ( int i=0 ; i<n ; i++){
    int a,b;
    cin >> a >> b;
    s.at(i) = make_pair(a,b) ;
  }
  forn(i,m){
    int a,b;
    cin >> a >> b;
    ch.at(i) = make_pair(a,b) ;
  }
  
  
  forn(j,n){
      int c,d;
      tie(c,d) = s.at(j);
     int ans ;
    int64_t mindis = 1000000000000000 ;
  forn(i,m){
    int dis=0;
    int a,b;
    tie (a,b) = ch.at(i);
    dis = abs(a-c)+abs(b-d) ;
    if ( mindis > dis){
      ans = i+1 ;
      mindis = dis ;
    }
  }
    cout << ans << endl;
  }
 
}


Measured memory_bytes: 3592
import bisect
n,m = map(int,input().split())
x = [list() for i in range(n)]
p = []
y = []
for i in range(m):
  s,t = map(int,input().split())
  p.append(s)
  y.append(t)
  x[s-1].append(t)
for i in range(n):
  x[i].sort()
  
for i in range(m):
  index = bisect.bisect_left(x[p[i]-1],y[i])
  print("{:06}{:06}".format(p[i],index+1))

Measured memory_bytes: 27044
//#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <bitset>
#include <string>
#include <set>
#include <stack>
#include <sstream>
#include <list>
#include <array>
#include <vector>
#include <queue>
#include <map>
#include <memory>
#include <iterator>
#include <climits>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;
#define FAST_IO ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef unsigned int UINT;
typedef unsigned long long ull;
typedef pair<int, int> pdi;
typedef pair<ll, int> pli;

int const maxn = 100 + 10;
inline int lc(int x)  {return x << 1;}
inline int rc(int x)  {return x << 1 | 1;}

int a[maxn], b[maxn];

int main(void) {
    FAST_IO;
    
    int n;
    cin >> n;
    for (int i = 1; i < n; i++){
        cin >> b[i];
    }
    a[1] = b[1];
    for (int i = 2; i < n; i++) {
        if (b[i - 1] == b[i]) {
            a[i] = b[i];
        } else {
            a[i] = min(b[i], b[i - 1]);
        }
    }
    a[n] = b[n - 1];
    ll sum = 0;
    for (int i = 1; i <= n; i++)
        sum += a[i];
    cout << sum << endl;
    
    return 0;
}

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

int main() {
    long long N;
    cin >> N;
    string res = "";
    while (N) {
        --N;
        res += (char)('a' + (N % 26));
        N /= 26;
    }
    reverse(res.begin(), res.end());
    cout << res << endl;
}

Measured memory_bytes: 3624
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int ama = n%k;
        if(ama >= 1){
            System.out.println(1);
        }else{
            System.out.println(0);
        }
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//

int main() {
    init();
    list<ll> L;
    
    ll N;
    cin >> N;
    rep(_, N){
        string s;
        cin >> s;
        if(s=="insert"){
            ll x;
            cin >> x;
            L.emplace_front(x);
        }
        else if(s=="delete"){
            ll x;
            cin >> x;
            for(auto itr = L.begin(); itr!=L.end(); itr++){
                if(*itr == x){
                    L.erase(itr);
                    break;
                }
            }
        }
        else if(s=="deleteFirst"){
            L.pop_front();
        }
        else{
            L.pop_back();
        }
    }

    if (!L.empty()){
        auto itr = L.begin();
        cout << *itr;
        while((++itr)!=L.end()){
            cout << " " << *itr;
        }
        cout << endl;
    }
}


Measured memory_bytes: 34492
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
#include<map>
#include<iostream>
const int maxn = 1e5 + 5;
const long long mod = 998244353;
using namespace std;
int G[maxn] , n , m;
long long ans , dp[1003][maxn];
struct node{
	int w , v;
};
node a[maxn];
long long dpr(){
	memset(dp , 0 , sizeof dp);
	for(int i = 1;i <= n;i++){
		for(int j = 1;j <= m;j++){
			dp[i][j] = dp[i - 1][j];
			if(a[i].w > j)continue;
			if(dp[i - 1][j - a[i].w] + a[i].v > dp[i - 1][j])
				dp[i][j] = a[i].v + dp[i - 1][j - a[i].w];
		}
	}
	return dp[n][m];
}
int main(){
	cin >> n >> m;
	for(int i = 1;i <= n;i++){
		cin >> a[i].w >> a[i].v;
	}
	ans = dpr();
	printf("%lld\n",ans);
return 0;
}

Measured memory_bytes: 784000
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    vector<ll> P;
    REP(i,n){
        int ai;
        cin >> ai;
        mp[ai]+=1;
        if(mp[ai]==2){
            mp[ai]=0;
            P.push_back(ai);
        }
    }
    sort(ALL(P), greater<int>());
    // cout << "maked pair is" << endl;
    // for(auto x : P) cout << x  << " ";
    // cout  << endl;
    if(P.size()<2) cout << 0 << endl;
    else cout << P[0]*P[1] << endl;
    return 0;
}

Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define reps(i, n) for (int i = 1; i <= (n); ++i)
#define repd(i, n) for (int i = (n)-1; i >= 0; --i)
#define repds(i, n) for (int i = (n); i > 0; --i)
#define loop(i, x, n) for (int i = (x); i < (n); ++i)
#define loops(i, x, n) for (int i = (x); i <= (n); ++i)
#define loopd(i, x, n) for (int i = (x); i > (n); --i)
#define loopds(i, x, n) for (int i = (x); i >= (n); --i)
#define itrep(i, a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i, a) for (auto i = rbegin(a); i != rend(a); ++i)
#define each(i, x) for (auto &&i : x)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(a) ((int)a.size())
#define pow2(n) (n * n)
#define int ll
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-9;
ll mod = static_cast<ll>(1e9 + 7);
template <class T, class... Args>
constexpr void mins(T &a, Args... args) { a = min<T>({a, args...}); }
template <class T, class... Args>
constexpr void maxs(T &a, Args... args) { a = max<T>({a, args...}); }
template <class F>
class FixPoint : private F {
public:
    explicit constexpr FixPoint(F &&f) : F(std::forward<F>(f)) {}
    template <class... Args>
    constexpr decltype(auto) operator()(Args &&... args) const { return F::operator()(*this, std::forward<Args>(args)...); }
};
template <class F>
constexpr decltype(auto) funcs(F &&f) { return FixPoint<F>{std::forward<F>(f)}; }
template <class T>
std::vector<T> vecs(int n, T &&val) { return std::vector<T>(std::forward<int>(n), std::forward<T>(val)); }
template <class... Args>
decltype(auto) vecs(int n, Args &&... args) { return std::vector<decltype(vecs(std::forward<Args>(args)...))>(std::forward<int>(n), vecs(std::forward<Args>(args)...)); }
template <class V, class T>
void fill(V &x, const T &val) { x = val; }
template <class V, class T>
void fill(vector<V> &vec, const T &val) {
    for (auto &&v : vec)
        fill(v, val);
}

void solve() {
    int a, b, c, d, k;
    cin >> a >> b >> c >> d >> k;
    int val = 60 * a + b;
    int val2 = 60 * c + d;
    cout << val2 - val - k << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    cout.flush();
    return 0;
}

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

int main(){
    int n,m,c;
    cin>>n>>m>>c;
    int ans=0,a[n][m],b[m];
  for(int i=0;i<m;i++) cin>>b[i];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++) cin>>a[i][j];
    }

    for(int i=0;i<n;i++){
        long long s=0;
        for(int j=0;j<m;j++) s+=a[i][j]*b[j];
        if(s+c>0) ++ans;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 384
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Kth Term
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

/* constant */

const int as[] = {
  1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
  1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
};

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int k;
  scanf("%d", &k);
  k--;

  printf("%d\n", as[k]);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  int l,a,b,c,d;

  cin >>l>>a>>b>>c>>d;


  if ((a+c-1)/c>(b+d-1)/d){
    cout << l-((a+c-1)/c);
  }else{
    cout << l-((b+d-1)/d);
  }
  cout <<endl;

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const ll mod=1000000007;
const ll INF=1e15;
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> P;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll H; cin>>H;
    ll count=1;
    while(H>=count) count*=2;
    cout<<count-1<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>
#include <assert.h>
#include <functional>
#include <unordered_map>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define ALL(a)			a.begin(), a.end()
#define REP(i, n)		for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n)	for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF				2e9
#define MOD				(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)		(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)		(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)	((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)		(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)		(!IsOdd((x)))						
#define	MAX_QWORD		((QWORD)0xFFFFFFFFFFFFFFFF)
#define M_PI			3.14159265358979323846
typedef long long		ll;
typedef pair<ll, ll>	P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
static int d[31][31];
static int c[501][501];
static int cList[3][31];
int N, C;
int getSumOne(int idx, int col)
{
	int sum = 0;
	REP(i, 31) {
		if (i != col) {
			sum += (cList[idx][i] * d[i][col]);
		}
	}
	return sum;
}

int main()
{
	cin >> N >> C;
	REP(i, C) REP(j, C) cin >> d[i + 1][j + 1];
	REP(i, N) REP(j, N) cin >> c[i][j];

	REP(i, N) REP(j, N) {
		int amari = (i + j) % 3;
		cList[amari][c[i][j]]++;
	}

	int ans = (int)INF;
	for (int i = 1; i <= C; i++) {
		for (int j = 1; j <= C; j++) {
			for (int k = 1; k <= C; k++) {
				if (i != j && j != k && k != i) {
					int one = 0;
					one += getSumOne(0, i);
					one += getSumOne(1, j);
					one += getSumOne(2, k);
					ans = min(ans, one);
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 1280
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
typedef long long ll;
int mod(ll a){
    int c=a%1000000007;
    if(c>=0)return c;
    else return c+1000000007;
}
typedef pair<int,int> i_i;


int main(){
    int n;cin>>n;
    bool a[105];
    for(int i=0;i<=100;i++)a[i]=false;
    for(int i=1;i<=n;i++){
        int c;cin>>c;
        a[c]=true;
    }
    int ans=0;
    for(int i=1;i<=100;i++){
        if(a[i]==true)ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[105];
int main(){
	int N; 
	double ave = 0;
	scanf("%d",&N);
	for(int i = 0 ; i < N ; ++i){
		scanf("%d",&a[i]);
		ave += a[i];
	}
	
	ave /= N;
	int ind;
	double dis = 10000;
	for(int i = 0 ; i < N ; ++i){
		if(abs(a[i] - ave) < dis){
			dis = abs(a[i] - ave);
			ind = i;
		}	
	}
	
	printf("%d\n",ind);
	return 0;	
}

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

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

		int[] n = new int[10];
		for (int i = 0; i < n.length; i++) {
			n[i] = sc.nextInt();

		}
		Arrays.sort(n);
		for (int i = 9; i >= 7; i--) {
			System.out.println(n[i]);
		}
	}
}

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

#define rep(i,k,n) for(int (i)=(k);(i)<(n);(i)++)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define abs(a) (a)>0 ?(a):-(a)
#define llong long long

int main(){
	int A,B,C,D; scanf("%d %d %d %d",&A,&B,&C,&D);
	if( (C-1)/B+1 > (A-1)/D+1 ) printf("No");
	else printf("Yes");
	return 0;
}


Measured memory_bytes: 1736
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node {int p, l, r;};

Node T[MAX];
int n, D[MAX];

void print(int u)
{
    int i, c;
    cout << "node " << u << ": ";
    cout << "parent = " << T[u].p << ", ";
    cout << "depth = " << D[u] << ", ";

    if (T[u].p == NIL) {
        cout << "root, ";
    } else if (T[u].l == NIL) {
        cout << "leaf, ";
    } else {
        cout << "internal node, ";
    }

    cout << "[";

    for (i = 0, c = T[u].l; c!= NIL; i++, c = T[c].r) {
        if (i) {
            cout << ", ";
        }
        cout << c;
    }
    cout << "]" << endl;
}

// 再帰的に深さを求める
void rec(int u, int p)
{
    D[u] = p;
    if (T[u].r != NIL) {
        rec(T[u].r, p);  // 右の兄弟に同じ深さを設定
    }
    if (T[u].l != NIL) {
        rec(T[u].l, p + 1);  // 最も左の子に自分の深さ+1を設定
    }
}

int main()
{
    int i, j, d, v, c, l, r;
    cin >> n;
    for (i = 0; i < n; i++) {
        T[i].p = T[i].l = T[i].r = NIL;
    }

    for (i = 0; i < n; i++) {
        cin >> v >> d;
        for (j = 0; j < d; j++) {
            cin >> c;
            if (j == 0) {
                T[v].l = c;
            } else {
                T[l].r = c;
            }
            l = c;
            T[c].p = v;
        }
    }
    for (i = 0; i < n; i++) {
        if (T[i].p == NIL) {
            r = i;
        }
    }
    rec(r, 0);

    for (i = 0; i < n; i++) {
        print(i);
    }
    return 0;
}


Measured memory_bytes: 7672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int D;
int s[367][28], c[28];
int last[28];

int main()
{
    cin >> D;
    for (int i = 1; i <= D; i++)
    {
        cin >> c[i];
    }
    for (int i = 1; i <= D; i++)
    {
        for (int j = 1; j <= 26; j++)
        {
            cin >> s[i][j];
            last[j] = 0;
        }
    }
    int t[367];
    int score, maxi;
    int best_i;

    for (int day = 1; day <= D; day++)
    {
        maxi = -100000;
        best_i = -1;
        for (int item = 1; item <= 26; item++)
        {
            score = s[day][item];
            for (int k = 1; k <= 26; k++)
            {
                score -= c[k] * (day - (item == k ? day : last[k]));
            }
            if (score > maxi)
            {
                maxi = score;
                best_i = item;
            }
        }
        t[day] = best_i;
        last[best_i] = day;
    }

    for (int i = 1; i <= D; i++)
    {
        cout << t[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  string S;
  
  cin >> S;
  if(S=="Sunny") cout << "Cloudy" << endl;
  else
  if(S=="Cloudy") cout << "Rainy" << endl;
  else
  cout << "Sunny" << endl;
}

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

int main()
{
bool A=1;
while(A){
 char stra[10], strb[10];
 int hit=0,bro=0;
 cin>>stra>>strb;

 for(int i=0;i<4;i++){
  if(stra[i]==strb[i]){
	hit++;}
  for(int j=0;j<4;j++){
	if(stra[i]==strb[j])
	 bro++;}
 }
if(stra[0]=='0'&&stra[1]=='\0'){break;}
bro=bro-hit;
cout<<hit<<' '<<bro<<'\n';

}
return 0;
}

Measured memory_bytes: 1140
using System;

public class Program
{
	public static void Main(string[] args)
	{
		var ss = new StreamScanner();
		//---------------------------------
		var x = ss.Next<int>();
		var y = ss.Next<int>();

		int d = x / y;
		int r = x % y;
		double f = x /(double)y;
		Console.WriteLine(d + " " + r + " " + f.ToString("F5"));










		/*
		//????????????int, double, string?????????????????£????????????
		int i = ss.Next<int>();
		double d = ss.Next<double>();
		string s = ss.Next<string>();

		//?????°???????????????????????¨?????????????????????????????????????????????????´???????
		int[] array = ss.Next<int>(10);
		*/
		//---------------------------------
	}
}



public class StreamScanner
{
	private readonly char[] _c = { ' ' };
	private int _index = -1;
	private string[] _input = new string[0];
	private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

	public T Next<T>()
	{
		if (_index == _input.Length - 1)
		{
			_index = -1;
			while (true)
			{
				string rl = _sr.ReadLine();
				if (rl == null)
				{
					if (typeof(T).IsClass) return default(T);
					return (T)typeof(T).GetField("MinValue").GetValue(null);
				}
				if (rl != "")
				{
					_input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
					break;
				}
			}
		}
		return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
	}

	public T[] Next<T>(int x)
	{
		var ret = new T[x];
		for (var i = 0; i < x; ++i) ret[i] = Next<T>();
		return ret;
	}

	public T[][] Next<T>(int x, int y)
	{
		var ret = new T[y][];
		for (var i = 0; i < y; ++i) ret[i] = Next<T>(x);
		return ret;
	}
}

Measured memory_bytes: 9924
from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))

# x_1 = (A_1 - A_2 + A_3 - A_4 + ... + A_N) / 2 である
# x_2 以降は代入しながら求めればよい
ans = ' '.join(
    str(2 * x)
    for x in accumulate(
        [sum((-1)**i * A[i] for i in range(N)) // 2] + A[:-1],
        lambda acc, a: a - acc
    )
)

print(ans)


Measured memory_bytes: 16304
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
    int MAX = 1000000;
    int lim = sqrt(MAX);
    vector<int> is_prime(MAX, 1);
    is_prime[0] = is_prime[1] = 0;
    for(int i = 2; i < MAX; ++i) {
        if(is_prime[i])
            if(i < lim) 
                for(int j = i*i; j < MAX; j += i) is_prime[j] = 0;
    }

    vector<int> primes;
    for(int i = 0; i < MAX; ++i)
        if(is_prime[i]) primes.push_back(i);

    int n;
    while(cin >> n) 
        cout << upper_bound(primes.begin(), primes.end(), n)-primes.begin() << endl;
    return 0;
}

Measured memory_bytes: 0
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define Graph vector<vector<int>>
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

struct Node{
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key) x = x->left;
        else x = x->right;
    }

    z->parent = y;
    if(y == NIL) root = z;
    else if(z->key < y->key) y->left = z;
    else y->right = z;
    
}

Node* find(Node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key) u = u->left;
        else u = u->right;
    }
    return u;
}

void preOrder(Node *u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preOrder(u->left);
    preOrder(u->right);
}

void inOrder(Node *u){
    if(u == NIL) return;
    inOrder(u->left);
    printf(" %d", u->key);
    inOrder(u->right);
}

int main(){
    int N;
    scanf("%d", &N);
    rep(i, N){
        char S[10];
        int k;
        scanf("%s%d", S, &k);
        if(S[0] == 'i') insert(k);
        else if(S[0] == 'f'){
            Node *u = find(root, k);
            if(u != NIL) printf("yes\n");
            else printf("no\n");
        } 
        else {
            inOrder(root);
            printf("\n");
            preOrder(root);
            printf("\n");
        }
    }
}


Measured memory_bytes: 21864
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto edges = new int[][](N);
    Tuple!(int, int)[] hoge;
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        edges[s[0]-1] ~= s[1]-1;
        edges[s[1]-1] ~= s[0]-1;
        hoge ~= tuple(s[0]-1, s[1]-1);
    }

    auto used = new bool[](N);
    void dfs(int n, int x, int y) {
        if (used[n]) return;
        used[n] = true;
        foreach (m; edges[n]) {
            if (x == n && y == m) continue;
            if (x == m && y == n) continue;
            if (!used[m]) dfs(m, x, y);
        }
    }

    int ans = 0;
    foreach (i; 0..M) {
        used.fill(false);
        dfs(0, hoge[i][0], hoge[i][1]);
        if (used.sum != N) ans += 1;
    }

    ans.writeln;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
#include <queue>
#include <math.h>
#include <string>
#include <sstream>
#include <stack>
 
using namespace std;
 
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define PI 3.14159265359
long long gcd(long long a,long long b){ return b==0?a:gcd(b,a%b);}
long long lcm(long long a,long long b){ return a/gcd(a,b)*b;}

int main() {
    ll n;
    cin >> n;
    ll a[n];
    ll l=1;
    ll ans=0;
    rep(i,n){
        cin >> a[i];
        ans+=a[i]-1;
       
    }
   
    cout << ans << endl;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >> n;
  int a = n % 10;
  if(a == 3)
    cout << "bon";
  else if(a == 0 or a == 1 or a == 6 or a == 8)
    cout << "pon";
  else
    cout << "hon";
}

Measured memory_bytes: 3560
def chmin(a,b):
  if a > b:
    return b
  else:
    return a

n,k = map(int,input().split())
A = list(map(int,input().split()))
f_inf = float('inf')
dp = [f_inf]*n
dp[0]=0
for i in range(n):
  for j in range(k+1):
    if i >= j:
      dp[i]=chmin(dp[i],dp[i-j]+abs(A[i]-A[i-j]))
print(dp[n-1])

Measured memory_bytes: 56032
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main() {
    fastio;
    int t,n=0;
    cin>>t;
    int a[t];
    for(int i=0;i<t;i++) cin>>a[i];
    for(int i=1;i<t-1;i++){
        if(a[i-1]<a[i] && a[i]<a[i+1]) n++;
        else if(a[i-1]>a[i] && a[i]>a[i+1]) n++;
    }
    cout<<n;
    return 0;
    }


Measured memory_bytes: 256
#include<iostream>

using namespace std;

struct card{
    char name[2];
    int value;
    char suit;
};

int judge_stable(card c[],card sorted_c[], int N){
    int beforenum = 10;
    int samenum = 1;
    for(int i=0; i<N; i++){
        if(beforenum==sorted_c[i].value){
            samenum += 1;
        }else samenum = 1;

        int iter = samenum;
        for(int j=0; j<N; j++){
            if(c[j].value==sorted_c[i].value){
                iter -= 1;
                if((c[j].suit!=sorted_c[i].suit) && iter==0){
                    cout << "Not stable" << endl;
                    return 0;
                }else break;
            }
        }
        beforenum = sorted_c[i].value;
    }
    cout << "Stable" << endl;
    return 0;
}

int main(){
    int N;
    cin >> N;
    card c[N], c1[N], c2[N];
    for(int i=0; i<N; i++){
        cin >> c[i].name;
        c[i].value = int(c[i].name[1]);
        c[i].suit = c[i].name[0];
        c1[i] = c[i]; c2[i] = c[i];
    }

    for(int i=0; i<N; i++){
        for(int j=N-1; j>=i+1; j--){
            if(c1[j].value < c1[j-1].value){
                card tmp = c1[j];
                c1[j] = c1[j-1];
                c1[j-1] = tmp;
            }
        }
    
    }

    for(int i=0; i<N; i++){
        int minj = i;
        for(int j=i; j<N; j++){
            if(c2[j].value<c2[minj].value){
                minj = j;
            }
        }
        card tmp = c2[i];
        c2[i] = c2[minj];
        c2[minj] = tmp;
    }

    for(int i=0; i<N-1; i++){
        cout << c1[i].name << " "; 
    }
    cout << c1[N-1].name << endl;
    judge_stable(c, c1, N);

    for(int i=0; i<N-1; i++){
        cout << c2[i].name << " "; 
    }
    cout << c2[N-1].name << endl;
    judge_stable(c, c2, N);
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        long w = Long.parseLong(sc.next());
        long[] wary = new long[n];
        int[] vary = new int[n];
        int max = 0;
        for (int i = 0; i < n; i++) {
            wary[i] = Long.parseLong(sc.next());
            vary[i] = Integer.parseInt(sc.next());
            if (max < vary[i]) {
                max = vary[i];
            }
        }
        long[][] dp = new long[n + 1][max * n + 1];
        Arrays.fill(dp[0], 1_000_000_005);
        dp[0][0] = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < max * n + 1; j++) {
                if (j < vary[i]) {
                    dp[i + 1][j] = dp[i][j];
                } else {
                    dp[i + 1][j] = Math.min(dp[i][j], dp[i][j - vary[i]] + wary[i]);
                }
            }
        }
        long ans = 0;
        for (int i = 0; i < max * n + 1; i++) {
            if (dp[n][i] <= w) {
                ans = Math.max(ans, i);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 127444
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
const int mod = 998244353;

signed main() {
	int a, b, c;
	scanf("%ld %ld.%ld", &a, &b, &c);
	a *= 100 * b + c;
	a /= 100;
	cout << a << endl;
}

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

int main(){
  string n; cin >> n;
  if(n[0] == n[1] && n[1] == n[2]) cout << "Yes" << endl;
  else if(n[1] == n[2] && n[2] == n[3]) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

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

  int n;
  long long k;
  cin >> n >> k;
  vector<vector<int>> ab(n, vector<int>(2));
  for (int i = 0; i < n; i++) {
    cin >> ab[i][0];
    cin >> ab[i][1];
  }
  sort(ab.begin(), ab.end());
  long long cnt = 0;
  for (auto &p : ab) {
    cnt += p[1];
    if (cnt >= k) {
      cout << p[0] << '\n';
      return 0;
    }
  }
}

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

using namespace std;

int main(void) {
  int a, b, c; cin >> a >> b >> c;
  
  if (a+b == c || b+c == a || c+a == b) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        char[] v = in.next().toCharArray();
        for (int i = 1; i < v.length; ++i) {
            if (v[i] == v[i - 1]) {
                System.out.println(i+" "+(i+1));
                return;
            }
        }
        for (int i = 2; i < v.length; ++i) {
            if (v[i] == v[i - 2]) {
                System.out.println((i - 1)+" "+(i+1));
                return;
            }
        }
        System.out.println((-1)+" "+(-1));
    }
}


Measured memory_bytes: 25836
using System;

namespace MyProgram{
    class AtCoder{
        static void Main(string[] args){
            long N = long.Parse(Console.ReadLine());
            string S = Console.ReadLine();
            long sum=0;
            char a = ' ';
            for(var i=0;i<N;i++){
                if(S[i]!=a){
                    sum++;
                }
                a = S[i];
            }
            Console.WriteLine(sum);
        }
    }
}

Measured memory_bytes: 13116
from itertools import permutations

def main():
    n = int(input())
    p = list(map(int, input().split()))
    q = list(map(int, input().split()))
    ns = [i for i in range(1,n+1)]
    l = list(permutations(ns,n))
    pt = tuple(p)
    qt = tuple(q)
    print(abs(l.index(pt)-l.index(qt)))

if __name__ == "__main__":
    main()

Measured memory_bytes: 8052
X, Y = map(int, input().split())
if (-X+2*Y)%3 != 0 or (2*X-Y)%3 != 0:
    print(0)
else:
    m = (-X+2*Y) // 3
    n = (2*X-Y) // 3
    if m < 0 or n < 0:
        print(0)
    else:
        mod = 10**9+7
        
        def modinv(a, mod):
            b = mod
            u = 1
            v = 0
            while(b):
                t = a // b
                a -= t * b
                a, b = b, a
                u -= t * v
                u, v = v, u
            
            u %= mod
            return u
    
    
        def modcmb(n, r, mod):
            X = 1
            for i in range(n-r+1, n+1):
                X = X * i % mod
            
            Y = 1
            for i in range(1, r+1):
                Y = Y * i % mod
                
            res = X * modinv(Y, mod) % mod
            return res
        
        print(modcmb(m+n, min(m, n), mod))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define repx(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

int main(){
    
    // 1. 入力情報.
    int X;
    scanf("%d", &X);
    
    // 2. N を 計算.
    LL N = 2;
    rep(i, X) N = 1 + N + (N + 1);
    
    // 3. 出力.
    printf("%lld\n", N);
    return 0;
}

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

// 内部定数
#define D_ARRAY_CNT		50										// 数列数

// 内部変数
static int siDCnt;												// 表示数

// 内部変数 - テスト用
#ifdef D_TEST
	static FILE *szpFpT;
#endif

// 表示
long long
fDsp(
	long long plVal				// <I> 値
)
{
	// スペース
	if (siDCnt > 0) {
		printf(" ");
	}

	// 表示
	printf("%lld", plVal);

	// 表示数
	siDCnt++;

	return 0;
}

// 実行メイン
int
fMain(
	int piTNo					// <I> テスト番号 1～
)
{
	int i;
	char lc1Buf[1024];

	// データ初期化
	siDCnt = 0;													// 表示数

	// テストファイルオープン
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", piTNo);
	szpFpT = fopen(lc1Buf, "r");
#endif

	// 操作回数取得
	long long llOCnt;
#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpT);
#else
	fgets(lc1Buf, sizeof(lc1Buf), stdin);
#endif
	sscanf(lc1Buf, "%lld", &llOCnt);

	// 全数列加算値
	long long llAll = llOCnt / (long long)D_ARRAY_CNT;

	// 加算数
	int liACnt = (int)(llOCnt % (long long)D_ARRAY_CNT);

	// 数列数表示
	printf("%d\n", D_ARRAY_CNT);

	// 数列表示
	for (i = 0; i < liACnt; i++) {
		fDsp(llAll + (long long)D_ARRAY_CNT - (long long)i);
	}
	for (i = liACnt; i < D_ARRAY_CNT; i++) {
		fDsp(llAll + (long long)D_ARRAY_CNT - (long long)(i + 1));
	}

	// 改行
	printf("\n");

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpT);
#endif

	return 0;
}

int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		fMain(i);
	}
#else
	fMain(0);
#endif

	return 0;
}



Measured memory_bytes: 128
using System;
using System.Linq;
using System.Collections.Generic;
namespace abc_113_c
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NM = Console.ReadLine().Split(' ');
            int N = int.Parse(NM[0]);
            int M = int.Parse(NM[1]);
            var D = new List<List<int>>();
            for (int i = 0; i < M; i++)
            {
                string[] PY = Console.ReadLine().Split(' ');
                int p = int.Parse(PY[0]);
                int y = int.Parse(PY[1]);                
                D.Add(new List<int>{p, y, i});
            }
            var SD = D.OrderBy(x => x[1]);
            var P = new Dictionary<int, int>();
            int[] C = new int[M];
            foreach (List<int> sd in SD )
            {
                int pref = sd[0];
                int year = sd[1];
                int city = sd[2];
                if (!P.ContainsKey(pref)) P[pref] = 0;
                P[pref] += 1;
                C[city] = P[pref];
            }
            for (int i = 0; i < M; i++)
            {
                Console.WriteLine("{0:000000}{1:000000}", D[i][0], C[i]);
            }
        }
    }
}


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

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

  int N, M;
  cin >> N >> M;

  vector<tuple<int, int, int>> YPi(M);
  for (int i = 0; i < M; i++) {
    int P, Y;
    cin >> P >> Y;
    YPi.at(i) = make_tuple(Y, P, i);
  }

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

  vector<int> cnt(N + 1, 1);

  vector<pair<int, int>> ans(M);
  for (int i = 0; i < M; i++) {
    ans.at(get<2>(YPi.at(i))) = make_pair(get<1>(YPi.at(i)), cnt.at(get<1>(YPi.at(i)))++);
  }

  for (int i = 0; i < M; i++) {
    cout << setw(6) << setfill('0') << ans.at(i).first;
    cout << setw(6) << setfill('0') << ans.at(i).second << endl;
  }
}

Measured memory_bytes: 3840
'''input
3
1 10 100
'''
n = input()
arr = map(int,raw_input().split())
ev,od,mf = 0,0,0
for i in range(n):
	if arr[i]%4 == 0:
		mf += 1
		continue
	elif arr[i]&1:
		od += 1
	else:
		ev += 1
if mf >= od:
	print "Yes"
elif mf >= od-1 and ev == 0:
	print "Yes"
else:
	print "No"



Measured memory_bytes: 40684
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double g[55];
  g[0]=0;
  cin>>n;
  for(int i=1;i<=n;i++) cin>>g[i];
  sort(g,g +n+1);
  for(int i=2;i<=n;i++){
    g[i]=(g[i]+g[i-1])/2.0;
  }
  cout<<g[n]<<'\n';
  return 0;
}

Measured memory_bytes: 256
import java.util.*

fun <T : Comparable<T>> min(i: T, j:T):T {
    return if (i < j) i else j
}

// ABC143 E
fun main(args: Array<String>) {
    val inf = Long.MAX_VALUE
    val (N, M, L) = readLine()!!.split(" ").map { it.toInt() }
    val dp = Array(N) {Array(N) {inf} }
    val dp2 = Array(N) {Array(N) {inf} }
    val A = IntArray(M)
    val B = IntArray(M)
    val C = IntArray(M)
    for (i in 0 until M) {
        val arr = readLine()!!.split(" ").map { it.toInt() }
        dp[arr[0]-1][arr[1]-1] = arr[2].toLong()
        dp[arr[1]-1][arr[0]-1] = arr[2].toLong()
        A[i] = arr[0]
        B[i] = arr[1]
        C[i] = arr[2]
    }
    val Q = readLine()!!.toInt()
    val s = IntArray(Q)
    val t = IntArray(Q)
    for (i in 0 until Q) {
        val arr = readLine()!!.split(" ").map { it.toInt() }
        s[i] = arr[0]
        t[i] = arr[1]
    }

    warshallFloyd(dp)

    for (j in 0 until N) {
        for (i in 0 until N) {
            if (dp[i][j] <= L) {
                dp2[i][j] = 1
            }
        }
    }

    warshallFloyd(dp2)

    for(i in 0 until Q) {
        val ans = dp2[s[i]-1][t[i]-1]
        if (ans == inf) {
            println(-1)
        } else {
            println(ans -1)
        }
    }
}

fun warshallFloyd(d: Array<Array<Long>>) {
    val n = d.size
    for (k in 0 until n) {
        for (i in 0 until n) {
            for (j in 0 until n) {
                if (d[i][k] != Long.MAX_VALUE && d[k][j] != Long.MAX_VALUE) {
                    d[i][j] = min(d[i][j], d[i][k] + d[k][j])
                }
            }
        }
    }
}

Measured memory_bytes: 127904
using System;

class ITP1
{
    static void Main()
    {
        int[] x=new int[26];
        
        while (true)
        {
            string str = Console.ReadLine();
            if (str == null) { break; }
            char[] ch = str.ToCharArray();
            for (int i = 0; i < ch.Length; i++)
            {
                for (int j = 0; j < 26; j++)
                {
                    if (ch[i] == 'a' + j || ch[i] == 'A' + j)
                    {
                        x[j]++;
                    }
                }
            }
        }
        for(int i=0;i<26;i++)
        {
            Console.WriteLine("{0} : {1}",(char)('a'+i),x[i]);
        }
    }
}

Measured memory_bytes: 5620