akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    ll ans = LLINF;
    ll A[N]; rep(i, N) cin >> A[i];
    //+,-,...
    ll res = 0, val = 0;
    if(A[0] > 0) val = A[0];
    else{
        val = 1;
        res = abs(A[0]) + 1;
    }
    for(int i = 1; i < N; i++){
        ll temp = val + A[i];
        if(val*temp < 0) val = temp;
        else{
            res += abs(temp) + 1;
            val = (val > 0) ? -1 : 1;
        }
    }
    ans = min(ans, res);

    //-,+,...
    res = 0;
    if(A[0] < 0) val = A[0];
    else{
        val = -1;
        res = abs(A[0] + 1);
    }
    for(int i = 1; i < N; i++){
        ll temp = val + A[i];
        if(val*temp < 0) val = temp;
        else{
            res += abs(temp) + 1;
            val = (val > 0) ? -1 : 1;
        }
    }
    ans = min(ans, res);
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
ll = list(map(int, input().split()))
ll.sort()
if ll[0]%2 == 1 and ll[1]%2 == 1 and ll[2] %2 == 1:
    v = min(ll[0]*ll[1],ll[1]*ll[2],ll[2]*ll[0])
    print(v)
else:
    print(0) 

Measured memory_bytes: 61860
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

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

int N,K;
map<char, int> cnt;
vector<int> d;
int main() {
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        string tmp;
        cin >> tmp;
        cnt[tmp[0]]++;
    }
    for (char i = 'A'; i <= 'Z'; i++){
        d.push_back(cnt[i]);
    }
    int res = 0;
    while (true){

        bool ok = false;
        sort(d.rbegin(), d.rend());
        int tmp = 0;
        for (int i = 0; i < d.size(); i++){
            if (d[i] > 0){
                d[i]--;
                tmp++;
            }
            if (tmp >= K){
                ok = true;
                break;
            }
        }
        if (not ok){
            break;
        }
        res++;
    }
    cout << res << endl;
   return 0;
 }


Measured memory_bytes: 888
//file_name:ABC70_C.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n;
    scanf("%d",&n);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    sort(a,a+n);
    ll g = a[0];

    ll ans = 1;

    rep(i,n){
        ll x = ans;
        ll y = a[i];

        while(true){
            if(y%x==0){
                g = x;
                break;
            }
            ll xx = x;
            x = y%x;
            y = xx;
        }
        a[i] /= g;
        ans = (ans*a[i]);
    }



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



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

using namespace std;

typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll w, h, x, y;
    cin >> w >> h >> x >> y;
    int m=0;
    if(x*2 == w && y*2 == h)m=1;
    cout << double(w*h)/double(2) << ' ' << m << endl;
    return 0;
}

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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> istream& operator>>(istream &is, vector<T> &v) { for(auto &it : v) is >> it; return is; }
template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int mod = 1e9+7;
const int N = 1e5+5;
int n;
vi g[N];
LL dp[N][2];

void dfs(int u, int p = -1){
    dp[u][0] = dp[u][1] = 1;
    for(int v: g[u]){
        if(v != p){
            dfs(v, u);
            dp[u][1] = (dp[u][1] * dp[v][0]) % mod;;
            dp[u][0] = (dp[u][0] * (dp[v][1] + dp[v][0]) % mod) % mod;
        }
    }
}

void solve(){
    cin >> n;
    for(int i = 1; i <= n; ++i) g[i].clear();
    for(int i = 0; i < n - 1; ++i){
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    memset(dp, 0, sizeof dp);
    dfs(1);
    cout << (dp[1][0]+dp[1][1])%mod << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


Measured memory_bytes: 17556
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pcc pair<char,char>
#define vi vector <int>
#define vl vector <ll>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d",x)
#define plld(x) printf("%lld",x)
#define pds(x) printf("%d ",x)
#define pllds(x) printf("%lld ",x)
#define pdn(x) printf("%d\n",x)
#define plldn(x) printf("%lld\n",x)
#define INF 2e9
#define INFLL 4e18
using namespace std;
ll powmod(ll base,ll exponent,ll mod){ // with mod < 1e9
	ll ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
ll gcd(ll a, ll b){
	if(b==0) return a;
	else return gcd(b,a%b);
}
const int upperlimit = 1e6+1;
const int mod = 1e9+7;
int main() {
	int n,k;
	sd(n);sd(k);
	int edges=n-1;
	int ans=n-1;ans*=n-2;ans/=2;
	if(k>ans){
		pd(-1);return 0;
	}
	ans-=k;
	edges+=ans;
	pdn(edges);
	for(int i = 2; i <= n; i++){
		pds(1);pdn(i);edges--;
	}
	for(int i = 2; i <= n; i++){
		for(int j = i+1; j <= n; j++){
			if(edges==0) break;
			pds(i);pdn(j);
			edges--;
		}
		if(edges==0) break;
	}
	return 0;
}

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

lint n, k, s;

int main() {
    cin >> n >> k >> s;
    // if (k == n) {
    //     for (int i = 0; i < n; i++) {
    //         cout << s << " ";
    //     }
    //     cout << endl;
    //     return 0;
    // } else {
    //     if (s < 3) {
    //         for (int i = 0; i < k; i++) {
    //             cout << s << " ";
    //         }
    //         for (int i = k; i < n; i++) {
    //             cout << s + 1 << " ";
    //         }
    //     }
    // }
    for (int i = 0; i < k; i++) {
        cout << s << " " << endl;
    }
    if (s == 1e+9) {
        for (int i = k; i < n; i++) {
            cout << s - 1 << endl;
        }
    } else {
        for (int i = k; i < n; i++) {
            cout << s + 1 << endl;
        }
    }
}

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

int main(void){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a-c)<=d || (abs(a-b)<=d && abs(b-c)<=d)){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll  n, i, j=0, a, b;
    cin>>a>>b;
    j=(b-1)/(a-1);
    //if(b==1) cout<<0<<endl;
    if(j*(a-1) == b-1) cout<<j<<endl;
    else cout<<j+1<<endl;
    return 0;
}




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


int main(void) {

	// 1_8-D Ring
	// ?????? T ????????????????????? W ?????°???????????????????????°??????
	
	char w[10];	//???????????????
	char x[11];
	int i;
	int result=0;

	scanf("%s",w);
	scanf("%11s",x);

	//??????????????????????????????uw???????´?
	for(i=0; i<strlen(w); i++){
		if( 'A'<=x[i] && w[i]<='Z' ){
			x[i] = w[i] + ('a'-'A');
		}
	}

	while(strcmp(x,"END_OF_TEXT")!= 0){
		for(i=0; i<strlen(w); i++){

			if( 'A'<=x[i] && x[i]<='Z' ){
				x[i] = x[i] + ('a'-'A');
			}
		}
		if(strcmp(x,w)==0){
			result++;
		}
		scanf("%11s",x);
	}
	printf("%d\n",result);
	return 0;
}

Measured memory_bytes: 548
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x) x
#define rep(...) MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T>using vv = vector<vector<T>>;
template<class T>vv<T> vvec(size_t n, size_t m, T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T>bool chmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
constexpr int INF = 1 << 28, MOD = 1e9 + 7; constexpr ll LINF = 1ll << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int main() {
    string s;
    cin >> s;
    int cnt_o = 0, cnt_x = 0;
    rep(i, s.size()) {
        if (s[i] == 'o') cnt_o++;
        else cnt_x++;
    }

    if (cnt_x < 8) {
        write("YES");
    }
    else {
        write("NO");
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define per(i,j,n) for(int i=(int)(j);(int)(n)<=i;i--)
#define int long long
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define endl "\n"
#define vi vector<ll>
#define pii pair<ll,ll>
#define vii vector<vi>
const int MOD=1e9+7;
//const int MOD=998244353;
const int INF=(1ll<<62)-1;
signed main(){
  REP(i,1,5){
    ll X; cin>>X;
    if(X==0){
      cout<<i<<endl;
      break;
    }
  }
}

Measured memory_bytes: 3448
#include <iostream>

using namespace std;
int bubbleSort(int [], int);
int main() {
	int n;
	int A[100];
	cin >> n;
	for(int i=0; i<n; i++)
		cin >> A[i];
	cout << bubbleSort(A, n) << endl;
	return 0;
}
int bubbleSort(int A[], int n){
	int sw = 0;
	int flag = 1;
	for(int i=0; flag; i++){
		flag = 0;
		for (int j=n-1; j>i; j--){
			if(A[j] < A[j-1]){
				int t = A[j];
				A[j] = A[j-1];
				A[j-1] = t;
				sw++;
				flag = 1;
			}
		}
	}
	for(int i=0; i<n-1; i++){
		cout << A[i] << ' ';
	}
	cout << A[n-1] << endl;
	return sw;
}

Measured memory_bytes: 3096
# D - equeue

# 何個取るか決める→左からいくつか取る→残りを右から取る→残りの操作回数だけ負の宝石を捨てる
# 何個取るか、左からいくつ取るか、でループ

from collections import deque
import heapq

N, K = map(int, input().split())
original_V = list(map(int, input().split()))

ans = []

for n_take in range(K+1):
    for n_take_from_left in range(n_take+1):
        have = []
        V = deque(original_V)
        
        for _ in range(n_take_from_left):
            if V:
                heapq.heappush(have, V.popleft())
            else:
                break
        
        for _ in range(n_take - n_take_from_left):
            if V:
                heapq.heappush(have, V.pop())
            else:
                break
    
        for _ in range(K - n_take):
            if have and have[0] < 0:
                heapq.heappop(have)
            else:
                break
                
        ans.append(sum(have))
    
print(max(ans))

Measured memory_bytes: 3444
N=int(input())

txylist=[]
old_t,old_x,old_y=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  txylist.append((t-old_t,abs(x-old_x),abs(y-old_y)))
  old_t,old_x,old_y=t,x,y
#print(txylist)

for t,x,y in txylist:
  if t%2!=(x+y)%2:
    print("No")
    break
  elif t<x+y:
    print("No")
    break
else:
  print("Yes")

Measured memory_bytes: 14152
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define pb push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define ll long long
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repv(i,a,b) for(int i=a;i>b;i--)
#define mkp(a,b) make_pair(a,b)
#define all(v) v.begin(),v.end()
#define max3(a,b,c) max(a,(max(b,c))
#define min3(a,b,c) min(a,(min(b,c))
#define read(a) cin>>a
#define readt(a,b) read(a),read(b)
using namespace std;
bool compare(pair<int,int>& p1,pair<int,int>& p2)
{
    return p1.second<p2.second;
}
int main()
{
    fastio
    string s;
    read(s);
    ll sum=0;
    rep(i,0,s.size())
    {
        sum+=(s[i]-48);
    }
    if(sum%9==0) cout<<"Yes\n";
    else cout<<"No\n";
    
}

Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
 
using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;

// 基本的な演算
namespace BasicMath {
    // 二つの値の最小値を求める関数
    static Int Min(const Int a, const Int b);
    static UInt UMin(const UInt a, const UInt b);
    // 二つの値の最小値を求める関数
    Int Min(const Int a, const Int b) {
        if (a <= b) {
            return a;
        } else {
            return b;
        }
    }
    UInt UMin(const UInt a, const UInt b) {
        if (a <= b) {
            return a;
        } else {
            return b;
        }
    }
}
using namespace BasicMath;

int main(void) {
    Int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << Min(a, b) + Min(c, d) << endl;
    return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <map>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

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

using namespace std;

const ll BIG = 1000000007LL;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

template<typename T>
void inputArray(T* p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

template<typename T>
void inputVector(vector<T> * p, int a){
    rep(i, a){
        T input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision = 0) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

const int Max = 110;
ll L, R;

int main(int argc, const char * argv[]) {
    cin >> L >> R;
    ll diff = R - L;
    const int M = 2019;
    if (diff >= M) {
        output(0);
        return 0;
    }

    int modmin, modmax;
    int modL = L%M;
    int modR = R%M;
    if (modR > modL) {
        modmin = modL;
        modmax = modR;
    } else {
        modmin = modR;
        modmax = M-1;
    }

    // printf("%d,%d,%d,%d\n", modL, modR, modmin, modmax);
    int ans = M;
    for (int i=modmin; i<=modmax; i++) {
        for (int j=i+1; j<=modmax; j++) {
            chmin(ans, (i*j)%M);
        }
    }

    output(ans);

    return 0;
}

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
int n,m,ans,ans2;
int p[100005],penalty[100005];
string kode[100005];
bool udah[100005];
vector<int>ac;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m;
    for(int i=1;i<=m;i++){
        cin>>p[i]>>kode[i];
        if(kode[i]=="AC" && udah[p[i]]==false){
            udah[p[i]]=true;
            ac.pb(p[i]);
            ans++;
        }
        if(udah[p[i]]==false) penalty[p[i]]++;
    }
    cout<<ans<<" ";
    for(auto isi:ac){
        ans2+=penalty[isi];
    }
    cout<<ans2<<endl;
}

Measured memory_bytes: 6656
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  cin>>str;

  long long sum=0;
  long long Anum=0;
  int index=0;
  while(index<(int)str.size()-2){
    if(str[index]=='A'){
      Anum++;
    }else{
      Anum=0;
    }
    if(str[index]=='A'&&str[index+1]=='B'&&str[index+2]=='C'){
      long long BCnum=0;
      index++;
      while(index<=(int)str.size()-2&&str[index]=='B'&&str[index+1]=='C'){
	BCnum++;
	index+=2;
      }
      sum+=Anum*BCnum;
    }else{
      index++;
    }
  }
  
  cout<<sum<<endl;
  return(0);
}


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

using namespace std;

int main() {
    string a, b, c;
    cin >> a >> b >> c;
    if (a[a.length() - 1] == b[0] && b[b.length() - 1] == c[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
function Main(s){
	s=s.split(/\n|\s/);
	s.forEach(function(e,i,a){a[i]=Number(a[i]);});
	var a;
	if(s[0]==0){a=1;}
	else if(s[0]==1){a=100;}
	else{a=10000;}
	if(s[1]==100){s[1]++;}
	console.log(a*s[1]);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using ll = long long;
using namespace std;

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

int main(void) {
	ll n;
	cin >> n;
	
	vector<ll> L(n + 1);
	L[0] = 2LL; L[1] = 1LL;
	for(int i = 2; i <= n; ++i) {
		L[i] = L[i - 1] + L[i - 2];
	}
	
	cout << L[n] << endl;
	
	return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(x,to) for(int x=0; x<(to); ++(x))
#define INF 1<<29
int main() {
    int n, k, q, a, b, c;
    int dist[100][100] = {};
    while (cin >> n >> k, n || k) {
        rep(i,n) {
            rep(j,n) {
                if(i!=j) dist[i][j] = INF;
            }
        }

        rep(m,k) {
            cin >> q;
            if(q==0) {
                cin >> a >> b;
                a--, b--;
                int ans = dist[a][b] == INF ? -1 : dist[a][b];
                cout << ans << endl;
            } else {
                cin >> a >> b >> c;
                a--, b--;
                dist[a][b] = dist[b][a] = min(dist[a][b], c);
                rep(i,n) {
                    rep(j,n) {
                        dist[i][j] = min(dist[i][j], dist[i][a]+dist[a][b]+dist[b][j]);
                        dist[i][j] = min(dist[i][j], dist[i][b]+dist[b][a]+dist[a][j]);
                    }
                }
            }
        }
    }
    return 0;
}

Measured memory_bytes: 1208
#!/usr/bin/env ruby

require 'prime'

loop do
  n = gets.chomp!.to_i
  break if n.zero?

  number = (2..n).reduce(:*)
  ar = []
  number.prime_division.each do |prm, cnt|
    if prm == 2 || prm == 5
      ar << cnt
    end
  end

  ar << 0 if ar.length != 2
  puts ar.min
end

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int s; cin>>s;
	map<int,int>m; ++m[s];
	int ans;
	for(int i=2;;++i){
		if(s&1)s=3*s+1;
		else s/=2;
		++m[s];
		if(m.at(s)==2){ans=i;break;}
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=100005;
int n,m;
int d[N];
int id[N];
vector<pair<int,int> >G[N];
int col[N];
int ans[N<<1];
void draw(int u)
{
	if(col[u]) return;
	for(auto [v,i]:G[u])
		if(col[v]==0&&d[u]==d[v])
		{
			col[u]=1,col[v]=2;
			ans[i]=d[u];
			return;
		}
	for(auto [v,i]:G[u])
		if(col[v])
		{
			col[u]=col[v]==1?2:1;
			ans[i]=d[u];
			return;
		}
	printf("-1");
	exit(0);
	return;
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%d",&d[i]),id[i]=i;
	sort(id+1,id+n+1,[=](const int &x,const int &y){return d[x]<d[y];});
	for(int i=1;i<=m;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		G[x].push_back(make_pair(y,i));
		G[y].push_back(make_pair(x,i));
	}
	for(int i=1;i<=n;i++)
		draw(id[i]);
	for(int i=1;i<=m;i++)
		if(!ans[i]) ans[i]=1e9;
	for(int i=1;i<=n;i++)
		if(col[i]==1) printf("W");
		else if(col[i]==2) printf("B");
	printf("\n");
	for(int i=1;i<=m;i++)
		printf("%d\n",ans[i]);
	return 0;
}

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

int main(){
  int x, a;
  cin >> x >> a;
  if(x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}

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

const int MAX=100005;
vector<int> S(MAX,1000000005),h(MAX);
int N,K;

void DP(int u){
    for(int i=2;i<=u;i++){
    if(i<=K+1) S[i]=abs(h[i]-h[1]);
    else{
        for(int j=1;j<=K;j++){
            S[i]=min(S[i],S[i-j]+abs(h[i]-h[i-j]));
    }
    }
    }
    cout<<S[u]<<endl;
}

int main(){
    
    cin>>N>>K;
    for(int i=0;i<N;i++){
        cin>>h[i+1];
    }
    DP(N);
    
}


Measured memory_bytes: 1024
def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def r_sort(a) a.sort{|a,b|b<=>a} end

n = inp[0]
h = inp
ans = 0
nans = 0
now = -1
h.each do |d|
  if(d <= now)
    nans += 1
    now = d
  else
    nans = 0
    now = d
  end
  ans = [nans,ans].max
end
p ans

Measured memory_bytes: 12300
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long
#define PI 3.14159265358979323846

using namespace std;
int main() {
    double a, b, x; std::cin >> a >> b >> x;
    double s = x / a;
    double ans = 0;
    double a2 = 0;
    if (s == a * b) {
        ans = 0;
    }
    else {
        if (s > b * a / 2) {
            double bu = 2 * s / a - b;
            s -= a * bu;
            b -= bu;
            a2 = 2 * s / b;
        }
        else {
            a2 = 2 * s / b;
        }
        double r = std::atan(b / a2);
        // ラジアン-角度変換
        ans = r * (180.0 / PI);
    }
    cout << fixed << setprecision(10) << ans << endl;

    return 0;
}

Measured memory_bytes: 4092
#include <iostream>

int32_t main(){
    int n;scanf("%d",&n);
    char s[n];scanf("%s",s);
    int v[n][3];
    if(s[0]=='R')v[0][0]=1;else v[0][0]=0;if(s[0]=='G')v[0][1]=1;else v[0][1]=0;if(s[0]=='B') v[0][2]=1;else v[0][2]=0;
    for(int i=1;i<n;i++){
        if(s[i]=='R') {v[i][0]=v[i-1][0]+1;v[i][1]=v[i-1][1];v[i][2]=v[i-1][2];}
        else if(s[i]=='G'){v[i][0]=v[i-1][0];v[i][1]=v[i-1][1]+1;v[i][2]=v[i-1][2];}
        else {v[i][0]=v[i-1][0];v[i][1]=v[i-1][1];v[i][2]=v[i-1][2]+1;}
    }
    // for(int i=0;i<n;i++){
    //     printf("%d %d %d\n",v[i][0],v[i][1],v[i][2]);
    // }
    long long int counter=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(s[i]!=s[j]){
                if('R'!=s[i]&&'R'!=s[j]){
                        counter+=(v[n-1][0]-v[j][0]);
                        if(j+(j-i)<n&&s[j+(j-i)]=='R') counter--;
                }
                else if('G'!=s[i]&&'G'!=s[j]){
                    counter+=(v[n-1][1]-v[j][1]);
                    if(j+(j-i)<n&&s[j+(j-i)]=='G') counter--;
                }
                else{
                    counter+=(v[n-1][2]-v[j][2]);
                    if(j+(j-i)<n&&s[j+(j-i)]=='B') counter--;
                }
            }
        }
    }
    printf("%lld\n",counter);
   return 0;
}

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

int main() {
int N, M;
cin >> N >> M;
if(N>=2 && M>=2) cout << N*(N-1)/2 + M*(M-1)/2 << endl;
if(N==1 && M==1) cout << 0 << endl;
if(N>=2 && M<=1) cout << N*(N-1)/2 << endl;
if(N<=1 && M>=2) cout << M*(M-1)/2 << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
  long long a,b;
  cin>>a>>b;
  vector<long long> vec(b);
  long long sum=0;
  rep(i,b){
      cin>>vec.at(i);
      sum+=vec.at(i);
  }
  if(sum>a){
      cout<<-1<<endl;
  }
  else{
      cout<<a-sum<<endl;
  }

}



Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
bool istrue(int n){
	int x=n%10;
	n/=10;
	while(n){
		if(n%10!=x){
			return false;
		}
		n/=10;
	}
	return true;
}
int main()
{
	int n;
	scanf("%d",&n);
	while(!istrue(n)){
		n++;
	}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 256
from collections import Counter 
N = int(input())
s = [input() for _ in range(N)]
 
# N=10^5より、O(N)で解く
for i in range(N):
  s[i] = sorted(s[i])
  s[i] = ''.join(s[i])

s = Counter(s).most_common()
ans = 0
for t in s:
  ans += t[1]*(t[1]-1)//2
  
print(ans)

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll ans = 0;
    rep(i, N) {
        ll cnt = A[i];
        if (i != N - 1) {
            if (cnt % 2) {
                ll next = A[i + 1];
                if (next >= 1) {
                    ans ++;
                    A[i + 1]--;
                }
            }
        }
        ans += cnt / 2;
    }
    cout << ans << '\n';
}

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


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

    vector<int>buri[100000];
    vector<int>po[100000];
    long long int dist[100000];
    void check(int anus){
        for(int i=0;i<buri[anus].size();i++){
            if(dist[buri[anus][i]]==-1){
                dist[buri[anus][i]]=dist[anus]+po[anus][i];
                check(buri[anus][i]);
            }
        }
    }

int main(void){
    int N;
    scanf("%d",&N);
    for(int i=0;i<N-1;i++){
        int kari1,kari2,kari3;
        scanf("%d %d %d",&kari1,&kari2,&kari3);
        buri[kari1-1].push_back(kari2-1);
        po[kari1-1].push_back(kari3);
        buri[kari2-1].push_back(kari1-1);
        po[kari2-1].push_back(kari3);
    }
    int Q,K;
    scanf("%d %d",&Q,&K);
    for(int i=0;i<N;i++)dist[i]=-1;
    dist[K-1]=0;
    check(K-1);
    for(int i=0;i<Q;i++){
        int x,y;
        scanf("%d %d",&x,&y);
        printf("%lld\n",dist[x-1]+dist[y-1]);
    }
    return 0;
}

Measured memory_bytes: 18176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define MOD (int) (1e9+7)
#define INF (int) 2e9
#define LLINF (ll) 2e18

int main(){
    int n;
    cin >> n;
    cout << n*n << endl;
    // printf("%d\n", N);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
string s;
void rec(int n , char MAX) {
    if(n==0) {
        cout << s << endl;
        return;
    }
    for(int i=9;i>=0;i--) {
        bool ok = false;
        char tmp = s.back();
        if(i>=2) {
            if((MAX-'a')-(i-1) < 0) continue;
            else s.push_back(MAX-(i-1));
        } else if(i==1) {
            s.push_back(MAX);
        } else {
            s.push_back(MAX+1);
            ok = true;
        }
        if(ok) rec(n-1, MAX+1);
        else rec(n-1, MAX);
        s.pop_back();
    }
}
int main() {
    int n; cin >> n;
    n--; s.push_back('a');
    //cout << s.back();
    rec(n,'a');
}


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

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


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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;


void solve(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	
	VVI(10, VI(4));
	int n, a;
	cin >> n >> a;
	VI v(n);
	vector<vector<map<int, ll>>> dp(n + 1, vector<map<int, ll>>(n * 50 + 1));
	
	rep(i, n) cin >> v[i];

	//rep(i, n * 50) dp[0][i].insert(0);
	dp[0][0][0] = 1;

	rep(i, n + 1){
		if (i == 0) continue;
		rep(j, n * 50 + 1){
			if (dp[i - 1][j].size() > 0){
				dp[i][j] = dp[i - 1][j];
			}
			if (j - v[i - 1] >= 0){
				for (auto x : dp[i - 1][j - v[i - 1]]){
					dp[i][j][x.first + 1] += x.second;
				}
			}
		}
	}
	ll ans = 0;
	FOR(i, 1, n){
		ans += dp[n][a * i][i];
	}

	cout << ans << endl;
}


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


	solve();
	//system("PAUSE");
	return 0;
}

Measured memory_bytes: 28288
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
//const long long MOD = 1000000007;
const long long MOD = 998244353;

using namespace std;



void solve()
{
    int n, K;
    scanf("%d%d", &n, &K);
    vector<int> a(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    sort(a.begin(), a.end());
    ll s = 0;
    for (i = 0; i < K; i++) {
        s += a[i];
    }
    printf("%lld\n", s);
    return;
}


int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 3228
#include <stdio.h>
#include <math.h>

#define DOT(v1, v2) (v1.x * v2.x + v1.y * v2.y)
#define CROSS(v1, v2) (v1.x * v2.y - v1.y * v2.x)
#define NORM(v) (v.x * v.x + v.y * v.y)
#define POW(v) (v * v)

typedef struct { double x, y; } point_t;
typedef point_t vector_t;
typedef struct { point_t p0, p1; } segment_t;
typedef segment_t line_t;
typedef struct { point_t p; double r; } circle_t;

static vector_t minus(vector_t v1, vector_t v2) {
  vector_t ret = { v1.x - v2.x, v1.y - v2.y };
  return ret;
}

static vector_t plus(vector_t v1, vector_t v2) {
  vector_t ret = { v1.x + v2.x, v1.y + v2.y };
  return ret;
}

static point_t polar(point_t o, double r, double a) {
  point_t p = { r * cos(a), r * sin(a) };
  return plus(o, p);
}

static segment_t cross_points(circle_t c1, circle_t c2) {
  segment_t s;

  double dd = NORM(minus(c1.p, c2.p));
  double d = sqrt(dd);
  double cosA = (POW(c1.r) + dd - POW(c2.r)) / (2 * c1.r * d);
  double a = acos(cosA);
  vector_t vd = minus(c2.p, c1.p);
  double t = atan2(vd.y, vd.x);

  s.p0 = polar(c1.p, c1.r, t + a);
  s.p1 = polar(c1.p, c1.r, t - a);
  point_t tmp = s.p1;
  if (s.p0.x > tmp.x || (s.p0.x == tmp.x && s.p0.y > tmp.y)) {
    s.p1 = s.p0;
    s.p0 = tmp;
  }
  return s;
}

int main(int argc, char **argv) {
  circle_t c1, c2;

  scanf("%lf %lf %lf", &c1.p.x, &c1.p.y, &c1.r);
  scanf("%lf %lf %lf", &c2.p.x, &c2.p.y, &c2.r);
  segment_t s = cross_points(c1, c2);
  printf("%.8lf %.8lf %.8lf %.8lf\n", s.p0.x, s.p0.y, s.p1.x, s.p1.y);
}


Measured memory_bytes: 2212
import std.stdio;
import std.conv;
import std.string;
import std.format;

void main()
{
  string s = chomp(readln());
  int a = to!int(s.split(" ")[0]);
  int b = to!int(s.split(" ")[1]);
  int c = to!int(s.split(" ")[2]);

  if ( a < b && b < c ) {
    writeln("Yes");
  } else {
    writeln("No");
  }
}

Measured memory_bytes: 2520
#include <bits/stdc++.h>
#include <ctime>
#include <cstdlib>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    int N;
    cin >> N;
    cout << N * N * N << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	b += MOD;
	a += b;
	a %= MOD;
}

vector<int> v;

int main(void){
	int n,k,h,i,ans=INF;
	cin >> n >> k;
	--k;
	for(i=0; i<n; ++i){
		cin >> h;
		v.push_back(h);
	}
	sort(v.begin(),v.end());
	for(i=k; i<n; ++i){
		ans = min(ans,v[i]-v[i-k]);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 892
import java.util.*;
import java.io.*;

public class Main {

  private static void solve() {
    int n = nextInt();

    int[][] act = new int[n][3];

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 3; j++) {
        act[i][j] = nextInt();
      }
    }

    int[][] dp = new int[n][3];
    for (int j = 0; j < 3; j++) {
      dp[0][j] = act[0][j];
    }

    for (int i = 1; i < n; i++) {
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if (k != j) {
            dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + act[i][j]);
          }
        }
      }
    }

    System.out.println(Math.max(dp[n - 1][0], Math.max(dp[n - 1][1], dp[n - 1][2])));
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

  private static int nextInt() {
    return Integer.parseInt(next());
  }

  private static long nextLong() {
    return Long.parseLong(next());
  }

  public static void main(String[] args) {
    run();
  }
}

Measured memory_bytes: 50092
while True:
    xy = input()
    xy_list = xy.split(" ")
    x = int(xy_list[0])
    y = int(xy_list[1])
    if x == 0 and y == 0:
        break
    if x > y:
        print(str(y) + " " + str(x))
    else:
        print(str(x) + " " + str(y))


Measured memory_bytes: 5608
#include<bits/stdc++.h>
#define M 1000000007
using namespace std;
typedef long long int ll;

int main()
{
   double r;
   cin>>r;
   double ans = (2.0*22.0*r)/7;
   cout<<fixed<<showpoint;
   cout<<setprecision(9)<<ans<<endl;
}


Measured memory_bytes: 3804
import math 
def ncr(m,n):
    return((math.factorial(m))/((math.factorial(n))*(math.factorial(m-n))))
nm=list(map(int,input().split()))
if(nm[0]<2 and nm[1]>=2):
    print(int(ncr(nm[1],2)))
elif(nm[0]>=2 and nm[1]<2):
    print(int(ncr(nm[0],2)))
elif(nm[0]<2 and nm[1]<2):
    print(0)
else:
    print(int(ncr(nm[0],2)+ncr(nm[1],2)))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <string>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007

int main(){
    int x;
    cin >> x;
    if(x<1200) cout << "ABC" << endl;
    else cout << "ARC" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
//#define mod 998244353ll
#define flagcount __builtin_popcount
#define flag(x) (1ll << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1ll << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return -1;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    ll n, k;
    cin >> n >> k;
    vec a(n);
    loop(i, n) cin >> a[i];
    loop(i, n - k)
    {
        if (a[i] < a[i + k])
            putout("Yes");
        else
            putout("No");
    }
    return 0;
}


Measured memory_bytes: 4784
#include <bits/stdc++.h>
using namespace std;
int n, a[200010];
const int mod = 1e9 + 7;
int inv[200010], jie[200010];
int cc(int x, int y)
{
    return 1ll * jie[x] * inv[y] % mod * inv[x - y] % mod;
}
int qp(int x, int y)
{
    int ans = 1;
    int base = x;
    while (y)
    {
        if (y % 2)
            ans = 1ll * ans * base % mod;
        base = 1ll * base * base % mod;
        y = y / 2;
    }
    return ans;
}
int main()
{
    jie[0] = 1;
    inv[0] = 1;
    for (int i = 1; i <= 200000; i++)
    {
        jie[i] = 1ll * jie[i - 1] * i % mod;
        inv[i] = qp(jie[i], mod - 2);
    }
    int n, k;
    scanf("%d%d", &n, &k);
    int ans = 0;
    for (int i = 0; i <= min(k, n - 1); i++)
    {
        ans = (ans + 1ll * cc(n, i) * cc(n - 1, n - i - 1) % mod) % mod;
        //printf("%d %d %d\n", n, n - i - 1, 1ll * cc(n, i) * cc(n - 1, n - i - 1));
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1792
s=str(input())
if s[0]!='A':
    print('WA')
else:
    c=s.count('C',2,len(s)-1)
    if c!=1:
        print('WA')
    else:
       d=s.find('C',2,len(s)-1)
       s=s[1:d]+s[d+1:]
       ss=s.lower()
       #print(s,ss)
       print('AC' if s==ss else 'WA')

Measured memory_bytes: 3060
#include<stdio.h>
int ta[200010],nt[400010],to[400010],co[400010],g;
int bfs(int v,int s){
  int q[1000000],C[400010],t=0,r=1,i,max=0;
  for(i=0;i<v;i++)C[i]=1000000000;
  for(C[q[0]=s]=0;r-t;t++){
    for(i=ta[q[t]];i+1;i=nt[i]){
      if(C[to[i]]>C[q[t]]+co[i])C[q[r++]=to[i]]=C[q[t]]+co[i];
      if(max<C[to[i]])max=C[g=to[i]];
    }
  }
  return max;
}//*/
//呼び出す方
//頂点数v、辺数eのaからbにコストcの辺がはられた木の直径を求める
int tyokkei(int v,int e,int *a,int *b){
  int i;
  for(i=0;i<v;i++)ta[i]=-1;
  for(i=0;i<e;i++){
    nt[i  ]=ta[to[i+e]=a[i]];
    nt[i+e]=ta[to[i  ]=b[i]];
    co[ta[b[i]]=i+e]=co[ta[a[i]]=i]=1;
  }
  bfs(v,0);
  return bfs(v,g);
}
int main(){
  int n,m,i,a[200010],b[200010];
  scanf("%d",&n);
  for(i=0;i<n-1;i++){
    scanf("%d %d",&a[i],&b[i]);
    a[i]--;
    b[i]--;
  }
  m=tyokkei(n,n-1,a,b)+1;
  //printf("%d\n",m);
  printf("%s\n",m%3!=2?"First":"Second");
  return 0;
}


Measured memory_bytes: 11520
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////

const int magic = 1000000007;

void add (int & a, int b) {
    a += b;
    if (a >= magic)
        a -= magic;
}

int mul (int a, int b) {
    return (int64)a * b % magic;
}

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

    int64 N, K;
    cin >> N >> K;

    int64 ans = 0;

    for (int64 k = K; k <= N + 1; k++) {
        int64 min_sum = k * (k + 1) / 2;
        int64 max_sum = k * (k + 1) / 2 + k * (N + 1 - k);
        //cerr << k << " " << min_sum << " " << max_sum << "\n";
        ans += max_sum - min_sum + 1;
        ans %= magic;
    }

    cout << ans << "\n";

    return 0;
}


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

int main() {
  long long N, H, W;
  cin >> N >> H >> W;
  vector<long long> A(N);
  vector<long long> B(N);
  int count = 0;
  for(int i = 0; i < N; i++) {
    cin >> A.at(i) >> B.at(i);
  }
  for(int i = 0; i < N; i++) {
    if(A.at(i) >= H && B.at(i) >= W) {
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 256
unittest
{
	assert( [ "7 17 120" ].parse.expand.solve == 119 );
	assert( [ "5 20 100" ].parse.expand.solve == 100 );
	assert( [ "6 18 100" ].parse.expand.solve == 100 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nab = input.front.split.to!( long[] );
	return tuple( nab[ 0 ], nab[ 1 ], nab[ 2 ] );
}

auto solve( long n, long a, long b )
{
	return min( a * n, b );
}


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

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var A = input[0];
            var B = input[1];
            var C = input[2];

            Console.WriteLine(Math.Min(C, B / A));
        }
    }
}


Measured memory_bytes: 13268
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
  int r = readln.chomp.to!(int);

  if (r < 1200) {
    writeln("ABC");
  }
  else if (r < 2800) {
    writeln("ARC");
  }
  else {
    writeln("AGC");
  }
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};

int w,h;
char fie[21][21];

void dfs(int x, int y){
    for(int i=0; i<4; i++){
        int xx = x + dx[i];
        int yy = y + dy[i];
        if(0 <= xx && xx < w && 0 <= yy && yy < h && fie[yy][xx] == '.'){
            fie[yy][xx] = '@';
            dfs(xx,yy);
        }
    }
}

int main(){
    while(cin >> w >> h , w||h){
        int sx,sy;
        for(int i=0; i<h; i++){
            cin >> fie[i];
            for(int j=0; j<w; j++){
                if(fie[i][j] == '@'){
                    sx = j; sy = i;
                }
            }
        }
        dfs(sx,sy);
        int ans = 0;
        for(int i=0; i<h; i++){
            for(int j=0; j<w; j++){
                if(fie[i][j] == '@') ans++;
            }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#include<math.h>
using namespace std;
using ll = long long;

int main(){
int n;
cin >> n;
int a = n%10;
int b = ((n-a)/10)%10;
int c =  (n-10*b -a)/100;
if(a==7||b==7||c==7)cout <<"Yes" << endl;
 else cout << "No" << endl;
return 0;
}
 

Measured memory_bytes: 3600
#include <stdio.h>
#include <string.h>
int main(){
  char s[11],r[11];
  scanf("%s",s);
  for(int i=0;i<11;i++)r[i]='\0';
  for(int i=0;i<strlen(s);i++){
    if(s[i]=='1')r[strlen(r)]='1';
    if(s[i]=='0')r[strlen(r)]='0';
    if(s[i]=='B')r[strlen(r)-1]='\0';
  }
  printf("%s",r);
  return 0;
}

Measured memory_bytes: 128