akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cstring>
int main ()
{
    int a,b,flag,len;
    char s[1000005];
    while(scanf("%d%d",&a,&b)!=EOF)
    {
        flag=1;
        scanf("%s",s);
         len=strlen(s);
        if(len!=(a+b+1))
             flag=0;
        else
        {
            if(s[a]!='-')
               flag=0;
            else
            {
                for(int i=0;i<len;i++)
                {
                    if(i==a)  continue;
                    else
                       if(s[i]<'0'||s[i]>'9')
                          flag=0;
                }
            }
        }
        if(flag)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}


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

using namespace std;

#define int long long

void solve() {
    int k;
    cin >> k;
    if (k % 7 == 0) k /= 7;
    int ost = 1 % k;
    int cnt = 0;
    while (cnt < 2 * k) {
        ++cnt;
        if (ost == 0) {
            cout << cnt;
            return;
        }
        ost = (ost * 10 + 1) % k;
    }
    cout << -1;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;


ll MX = 1000'000'000'000'000'000LL;


int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	ll A;

	string s;

	cin >> A >> s;

	int B = stoi(s.substr(0, 1)) * 100 + stoi(s.substr(2));

	cout << (A * B) / 100 << '\n';



	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


Measured memory_bytes: 3656
#include<iostream>
#include<math.h>
#include<string.h>
#include<set>
#include<algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main(){
    int a,b;
    cin>>a>>b;
    string c[101];
    rep(i,a)cin>>c[i];
    rep(i,b+2)cout<<'#';
    cout<<endl;
    rep(i,a)cout<<"#"<<c[i]<<"#"<<endl;
    rep(i,b+2)cout<<'#';
}

Measured memory_bytes: 256
#include<iostream> 
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath> 
#include<algorithm> 
using namespace std;
const int maxn=500010,inf=1e9;
int n;
int g[1<<26],f[maxn],sum[maxn];
char s[maxn];
inline void read(int &k)
{
	int f=1;k=0;char c=getchar();
	while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar();
	while(c<='9'&&c>='0')k=k*10+c-'0',c=getchar();
	k*=f;
}
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	for(int i=1;i<=n;i++)sum[i]=sum[i-1]^(1<<(s[i]-'a'));
	memset(f,32,sizeof(f));memset(g,32,sizeof(g));
	f[0]=g[0]=0;
	for(int i=1;i<=n;i++)
	{
		f[i]=min(f[i],g[sum[i]]+1);
		for(int j=0;j<26;j++)
		f[i]=min(f[i],g[sum[i]^(1<<j)]+1);
		g[sum[i]]=min(g[sum[i]],f[i]);
	}
	printf("%d\n",f[n]);
}

Measured memory_bytes: 265856
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<cstdint>
#include<bits/stdc++.h>
#include<queue>
#include<set>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep_r(i, n) for(int i = n-1; i >= 0; i--)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((ll)(x).size())
#define bit(n) (1LL<<(n))
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define INF bit(60)
#define pb push_back
#define mod 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;
using uif=uint_fast64_t;
using ll=long long int;

int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mod;a=1ll*a*a%mod;}while(b>>=1);return ans;}
int qp(int a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(void){

  ll n,ww;
  cin>>n>>ww;
  vector<ll> w(n);
  vector<ll> v(n);
  vector<ll> value(ww+1,0);
  vector<ll> tmp_value(ww+1,0);


  rep(i,n){
    cin>>w[i];
    cin>>v[i];
  }
  rep(i,n){
    rep(j,ww+1){
      if(j+w[i] > ww) continue;
      tmp_value[j+w[i]] = max(value[j+w[i]],value[j]+v[i]);
    }
    rep(j,ww+1){
      value[j] = tmp_value[j];
    }
  }
  cout << *max_element(all(value)) << endl;


  return 0;

}


Measured memory_bytes: 1920
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
struct Database {
	int N, M, r, q;
	vector<vector<int>> use;

	Database() 
	{
		cin >> N >> M;
		if (N == 0)return;
		use.resize(M+1, vector<int>(60 * 24));

		cin >> r;
		REP(i, r) {
			int t, n, m, s;
			cin >> t >> n >> m >> s;
			use[m][t] += (s == 1 ? 1 : -1);
		}
		REP(i, M+1)REP(t, 60 * 24-1)
			use[i][t + 1] += use[i][t];
	}
	
	void query()
	{

		int ts, te, m;
		cin >> ts >> te >> m;
		
		int res = 0;
		FOR(t, ts, te) {
			res += (use[m][t] > 0 ? 1 : 0);
		}
		//cerr << "==========";
		cout << res << endl;
	}
};


//メイン関数
int main()
{
	while (true) {
		Database base;
		if (base.N == 0)break;

		int q;
		cin >> q;
		REP(i, q)base.query();
	}

	return 0;
}



Measured memory_bytes: 57724
#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ld = long double;
using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

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


int main(){
    int X, Y; cin >> X >> Y;
    cout << ((X % Y) ? X : -1) << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
		int k = scan.nextInt();
		int max =0;
		max = Math.max(a, b);
		max=Math.max(max, c);
		int nibai = max;
		for(int i=0;i<k;i++) {
			nibai =  nibai* 2;
		}
		System.out.println(nibai+a+b+c-max);
	}

}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
bool v[2000003];
long long n,p,k;
long long sol;
int main()
{
    ios::sync_with_stdio(false);
    cin>>n>>p;
    if(n==1)
    {
        cout<<p;
        return 0;
    }
    while(p%2==0)
    {
        ++k;
        p/=2;
    }
    k=k/n;
    sol=1;
    while(k--) sol*=2ll;
    for(int i=3;i<1000000;i+=2)
    {
        if(v[i]==1) continue;
        k=0;
        while(p%i==0)
        {
            ++k;
            p/=i;
        }
        k=k/n;
        while(k--) sol*=1ll*i;
        for(int j=2*i;j<1000000;j+=i) v[j]=1;
    }
    cout<<sol;
    return 0;
}


Measured memory_bytes: 1280
use std::collections::HashMap;
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn exe(n: u32) -> u32 {
    let tmp = n % 2;
    if tmp == 0 {
        n / 2
    } else {
        (n / 2) + 1
    }
}

fn main() {
    input! {n: u32}
    println!("{}", exe(n));
}


Measured memory_bytes: 4352
num = gets.split.map(&:to_i)
a = num[1].div(num[2]) + num[1].div(num[3]) - num[1].div(num[2].lcm(num[3]))
b = (num[0] - 1).div(num[2]) + (num[0] - 1).div(num[3]) - (num[0] - 1).div(num[2].lcm(num[3]))

puts num[1] - num[0] - (a - b) + 1

Measured memory_bytes: 1788
/*input
1 4 5
3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=200005;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

void ensure(bool t){
	if(!t){
		cout<<"QAQ\n";
		exit(0);
	}
}

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int low(int n){return n&(-n);}

struct BIT{
	ll v[maxn];
	vector<pll> op;
	BIT(){
		REP(i,maxn) v[i]=0;
		op.clear();
	}
	void update(int n,int d){
		ensure(n>=0&&n<maxn);
		d%=MOD;
		for(int i=n;i<maxn;i+=low(i+1)){
			v[i]+=d;
			if(v[i]>=MOD) v[i]-=MOD;
		}
		op.pb(MP(n,d));
	}
	void QAQ(int n,int d){
		ensure(n>=0&&n<maxn);
		d%=MOD;
		for(int i=n;i<maxn;i+=low(i+1)){
			v[i]+=d;
			if(v[i]>=MOD) v[i]-=MOD;
		}
	}
	ll query(int n){
		ensure(n>=0&&n<maxn);
		ll ret=0;
		for(int i=n;i>=0;i-=low(i+1)){
			ret+=v[i];
			if(ret>=MOD) ret-=MOD;
		}
		return ret;
	}
	void clear(){
		for(auto i:op){
			//assert(i.F>=0&&i.F<maxn);
			QAQ(i.F,MOD-i.S);
		}
		op.clear();
		op.shrink_to_fit();
	}
}X,Y;

int n;
ll A,B;
ll a[maxn];

int main()
{
	IOS;
	cin>>n>>A>>B;
	REP(i,n) cin>>a[i];

	X.update(0,1);
	Y.update(0,1);

	for(int i=1;i<n;i++){
		ll Xtmp,Ytmp;
		{
			int idx=upper_bound(a,a+n,a[i]-A)-a;
			Xtmp=Y.query(idx);
		}
		{
			int idx=upper_bound(a,a+n,a[i]-B)-a;
			Ytmp=X.query(idx);
		}
		// cout<<Xtmp<<' '<<Ytmp<<'\n';
		if(a[i]-a[i-1]<A){
			X.clear();
		}
		if(a[i]-a[i-1]<B){
			Y.clear();
		}
		X.update(i,Xtmp);
		Y.update(i,Ytmp);
		// X.print();
		// Y.print();
	}
	cout<<(X.query(n)+Y.query(n))%MOD<<'\n';
	return 0;
}


Measured memory_bytes: 7592
//2020.1.21
//s1270188 xxxmk2
//v0_02

#include<stdio.h>

int main(){
  int a, b;

  while(1){
    if(scanf("%d %d",&a,&b)==EOF) break;;
    a+=b;
    
    for(b=0;a!=0;b++) a/=10;
    printf("%d\n",b);
  }
  
  return 0;
}



Measured memory_bytes: 2044
#include <stdio.h>
int isprime(int n) {
	int i;
	for(i = 2; i * i <= n; i++) {
		if(n % i == 0) return 0;
	}
	return 1;
}

int main(){
	int n,i,k;
	int max = 2;
	while(1){
		scanf("%d",&n);
		if(n == 0){
			break;
		}
		/*
		for(i = 2;i < n-2;i++){
			if(isprime(i)==1 && isprime(i+2)==1 && i>max){
				max = i;
			}
		}
		*/
		for(i = n;i > 2;i--){
			if(isprime(i)==1 && isprime(i-2)==1){
				max = i;
				break;
			}
		}
		
		printf("%d %d\n",max-2,max);
		max = 2;
	}
	
	return 0;
}

Measured memory_bytes: 600
n = int(input())
a = list(map(int, input().split()))

ans = 0
done = False
while not done:
    for i in range(n):
        if a[i]%2 == 0:
            a[i] = a[i]/2
        else:
            done = True
            break
    if not done:
        ans += 1
print(ans)


Measured memory_bytes: 2940
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

string s;
int d, k;
vector<int> vec;
int dp[100][4][2];

int go(int pos, int cnt, bool flag) {
    if (cnt > k)
        return 0;

    if (pos == vec.size())
        return cnt == k;

    if (dp[pos][cnt][flag] != -1)
        return dp[pos][cnt][flag];

    int limit = vec[pos];
    if (flag)
        limit = 9;

    int res = 0;
    for (int i = 0; i <= limit; i++) {
        int newCnt = cnt + (i != d);
        bool newFlag = flag;
        if (flag == false && i < limit)
            newFlag = true;

        res += go(pos + 1, newCnt, newFlag);
    }

    return dp[pos][cnt][flag] = res;
}

int solve(string s) {
    vec.clear();
    for (auto c : s)
        vec.push_back(c - '0');
    
    memset(dp, -1, sizeof(dp));
    int res = go(0, 0, false);
    return res;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        cin >> s >> k;
        cout << solve(s) << '\n';        
    }
    
    return 0;
}



Measured memory_bytes: 3624
N = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans *= a
    if  ans > 1000000000000000000:
        break

if 0 in A:
    print(0)
elif ans > 1000000000000000000:
    print(-1)
else:
    print(ans)


Measured memory_bytes: 84556
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<int> a(4);
  for(int &v:a) cin >> v;
  sort(a.begin(), a.end());
  if(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    list.add(sc.nextInt());
    list.add(sc.nextInt());
    list.add(sc.nextInt());
    Collections.sort(list);
    int A = list.get(0);
    int B = list.get(1);
    int C = list.get(2);
    
    int a = C-B;
    int b = C-A;
    
    int n = a + b;
    int ans = 0;
    if(n % 2 == 0){
      ans = n / 2;
    }else{
      ans = (n/2)+2;
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 23252
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
int main(){
  ll n;cin>>n;
  vl a(n);
  rep(i,n)cin>>a[i];
  vector<ll>ans;
  map<ll,ll>M;
  rep(i,n)M[a[i]]++;
  for(auto p:M){
    if(p.second>=4){
      ans.push_back(p.first);
      ans.push_back(p.first);
    }
    else if(p.second>=2){
      ans.push_back(p.first);
    }
  }
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  if(ans.size()<2){
    cout<<0<<endl;
    return 0;
  }
  cout<<ans[0]*ans[1]<<endl;
  return 0;
}


Measured memory_bytes: 7296
import java.util.*;
import static java.lang.System.*;

public class Main {

	Scanner sc = new Scanner(in);
	
	void run() {
		int[] a = new int[100001];
		while (true) {
			int n = sc.nextInt(), k = sc.nextInt();
			if (n == 0 && k == 0) break;
			for (int i = 0; i < n; i++)
				a[i] = sc.nextInt();
			int max = 0;
			for (int i = 0; i < k; i++)
				max += a[i];
			int sum = max;
			for (int i = 0; i < n-k; i++) {
				sum = sum - a[i] + a[i+k];
				max = Math.max(max, sum);
			}
			out.println(max);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 64180
def zet(num):
    if num<0:
        return -num
    else:
        return num

x,k,d = map(int, input().split())
x = zet(x)
amari = x%d
syou = x//d
if syou > k:
    syou = k

sa = k-syou
genzai = zet(x) - syou * d
if sa == 0:
    print(genzai)
    exit()
    
if sa % 2 == 0:
    print(genzai)
else:
    print(zet(genzai - d))

Measured memory_bytes: 9192
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    ll n; cin >> n;
    string s; cin >> s;

    ll sum_b[n+1] = {};
    ll sum_w[n+1] = {};

    reps(i, 1, n+1){
        if(s[i-1] == '.'){
            sum_w[i] = sum_w[i-1] + 1;
            sum_b[i] = sum_b[i-1];
        }
        else{
            sum_b[i] = sum_b[i-1] + 1;
            sum_w[i] = sum_w[i-1];
        }
    }

    // rep(i, n+1){
    //     cout << sum_w[i] << " " << sum_b[i] << endl;
    // }

    ll ans = 1e18;

    // bool allsame = true;
    rep(i, n-1){
        if(s[i] == '.' && s[i+1] == '#'){
            ll left = sum_b[i+1];
            ll right = sum_w[n] - sum_w[i+1];
            // cout << i << " " << left << " " << right << endl
            ll temp = sum_b[i+1] + sum_w[n] - sum_w[i+1];
            ans = min(temp, ans);
            // allsame = false;
        }
        else if(s[i] == '#' && s[i+1] == '.'){
            // allsame = false;
        }
    }

    ans = min(ans, sum_w[n]);
    ans = min(ans, sum_b[n]);

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3732
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <math.h>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <ctime>
#include <deque>
#include <unordered_map>
#include <map>
#include <random>
#include <cstdio>
#include <string>
#include <cctype>
#define int long long
#define pb push_back
#define eb emplace_back
#define rs resize
#define ld long double
#define vi vector<int>


using namespace std;

const double PI = atan2(0, -1);

void solve() {
    int n; cin >> n;
    int sum = 0;
    sum += n / 500 * 1000;
    n -= n / 500 * 500;
    sum += n / 5 * 5;
    cout << sum;
}


signed main() {
    ///  freopen("salesman.in", "r", stdin);
   //   freopen("salesman.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed;
    cout.precision(30);
    int t = 1;
    while(t--)
    solve();
    //   system("pause");
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#include <map>
#include <cmath>
#include <string>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define Cout(s) cout<<s<<endl
typedef long long ll;
using namespace std;
string Yes(bool b) { if (b) { return "Yes"; } else { return "No"; } }
string YES(bool b) { if (b) { return "YES"; } else { return "NO"; } }
//================================================

int a = 0, b = 0, c, d, n, k = 0;
string s, t;


int main()
{
	cin >> a >> b;
	cout << max({ a + b,a - b,a * b }) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;

int R, C, K, Sr, Sc;
bool m[805][805];
int dist[805][805];

int minr = 1e9, maxr, minc = 1e9, maxc;

bool seen[805][805];
int sr[10000000], sc[10000000], ss, se;

void push(int r, int c, int d) {
    if (seen[r][c] || !m[r][c]) return;
    seen[r][c] = 1;
    sr[se] = r;
    sc[se++] = c;
    dist[r][c] = d;
}

int main() {
    scanf("%d %d %d", &R, &C, &K);
    char s;
    for (int r = 1; r <= R; r++) for (int c = 1; c <= C; c++) {
        scanf(" %c", &s);
        m[r][c] = 1;
        if (s == '#') m[r][c] = 0;
        else if (s == 'S') Sr = r, Sc = c;
    }
    sr[se] = Sr, sc[se++] = Sc;
    seen[Sr][Sc] = 1;
    while (ss < se) {
        int r = sr[ss], c = sc[ss];
        ss++;
        if (r < minr) minr = r;
        if (r > maxr) maxr = r;
        if (c < minc) minc = c;
        if (c > maxc) maxc = c;
        if (dist[r][c] < K) {
            push(r+1,c,dist[r][c]+1);
            push(r-1,c,dist[r][c]+1);
            push(r,c+1,dist[r][c]+1);
            push(r,c-1,dist[r][c]+1);
        }
    }

    int d = min(min(minr-1,minc-1),min(R-maxr,C-maxc));
    printf("%d\n", 1 + (d+K-1)/K);
}

Measured memory_bytes: 14592
while 1:
    n=int(raw_input())
    if n==0:
        break
    l=[[0]*n for i in range(n)]
    x,y=n/2,n/2+1
    l[y][x]=1
    cnt=2
    while cnt<=n**2:
        x,y=(x+1)%n,(y+1)%n
        if l[y][x]==0:
            l[y][x]=cnt
            cnt+=1
        else:
            x,y=(x-1)%n,(y+1)%n
            l[y][x]=cnt
            cnt+=1
    for i in range(n):
        print ''.join(map(lambda s:str(s).rjust(4),l[i]))

Measured memory_bytes: 6356
N = int(input())
i = 0
while i < N // 4:
    if (N - 4 * i) % 4 == 0:
        print('Yes')
        break
    elif (N - 4 * i) % 7 == 0:
        print('Yes')
        break
    else:
        i += 1
if i == N // 4:
    print('No')

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

int main() {
	int n ;
	cin >> n;
	vector<int> a(n,0);
	for(int i=0;i < n;i++)
	{
		cin >> a.at(i);
	}
	int sm = 0;
	for(int i = 0;i<n;i++)
	{
		for(int j = i+1;j<n;j++)
		{
			sm += a.at(i) * a.at(j);
		}
	}
	cout << sm << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    double a, b, x;
    cin >> a >> b >> x;
    double volC = a*a*b;
    double volW = x;
    double pi = 4 * atan(1);
    if (volW > volC / 2)
    {
        double z = 2 * x / (a * a) - b;
        // cout << b - z << endl;
        cout << setprecision(12) << atan((b - z) / a) * 180 / pi;
    }
    else if (volW < volC / 2)
    {
        double z = 2 * x / (b * a);
        cout << setprecision(12) << atan(b / z) * 180 / pi;
    }
    else 
        cout << 45;
    return 0;
}

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

#define REP(i, n) for(int (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(int (i) = (n); (i) >= 0; --(i))
#define FOR(i, n, m) for(int (i) = (n); (i) < (m); ++(i))

// constexpr int INF = 1e9;
constexpr ll INF = 1LL<<61;
constexpr ll mod = 1e9+7;

int main(){
  int N;
  cin >> N;
  map<int, int> an, mset;
  REP(i, N){
    int d;
    cin >>d;
    an[d]++;
  }
  int M;
  cin >> M;
  REP(i, M){
    int t;
    cin >> t;
    mset[t]++;
  }
  for(auto m : mset){
    if(an[m.first] < m.second){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;

  return 0;
}


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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> m(h);
	vector<vector<int>>dp(h, vector<int>(w, 999999));

	for (int i = 0; i < h; i++) {
		cin >> m.at(i);
	}

	if (m[0][0] == '#')dp[0][0] = 1;
	else dp[0][0] = 0;

	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i == 0 && j == 0)continue;
			if (i == 0)dp[i][j] = dp[i][j - 1] + (m[i][j] == '#' && m[i][j - 1] == '.');

			else if(j == 0)dp[i][j] = dp[i - 1][j] + (m[i][j] == '#' && m[i - 1][j] == '.');

			else dp[i][j] = min(dp[i][j - 1] + (m[i][j] == '#' && m[i][j - 1] == '.'),
				dp[i - 1][j] + (m[i][j] == '#' && m[i - 1][j] == '.'));
		}
	}
	cout << dp[h - 1][w - 1] << endl;
}


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

#define EPSILON 1e-6
#define ll long long

int main(int argc, char* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int a, b, c;
  cin >> a >> b >> c;

  if (a == b && b == c) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 4010, M = 110;

int n;
char s[N];

int main()
{
	scanf("%d%s", &n, s);
	
	int g = 0;
	for (int i = 0; i < n; i ++ )
		if (s[i] == 'G')
			g ++ ;
	
	LL res = 0;
	for (int i = 0; i < n; i ++ )
		for (int j = i + 1; j < n; j ++ )
			if (s[i] == 'R' && s[j] == 'B' || s[i] == 'B' && s[j] == 'R')
			{
				res += g;
				int d = j - i;
				if (i - d >= 0 && s[i - d] == 'G') res -- ;
				if (j + d < n && s[j + d] == 'G') res -- ;
				if ((i % 2) == (j % 2) && s[(i + j) / 2] == 'G') res -- ;
			}
	
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 3792
N = int(input())
xyhlist = []
idx = -1
for i in range(N):
    xyhlist.append(tuple(map(int, input().split())))
    if xyhlist[-1][2] > 0:
        idx = i

px, py, ph = xyhlist[idx]
for cx in range(101):
    for cy in range(101):
        ch = abs(px - cx) + abs(py - cy) + ph

        ok = True
        for (x, y, h) in xyhlist:
            if max(ch - abs(x - cx) - abs(y - cy), 0) != h:
                ok = False
                break
        if ok:
            print(cx, cy, ch)
            break

Measured memory_bytes: 3064
#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 lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

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

    lol n, c, k;
    cin >> n >> c >> k;
    lol t[n + 5];
    rep(i, n){
      cin >> t[i];
    }
    sort(t, t +n);
    lol ans = 0, Busper = 1;
    reps(i, n - 1){
      if(Busper == c || t[i] > t[i - Busper] + k){
	ans ++;
	Busper = 1;
      } else {
	Busper ++;
      }
    }
    if(Busper > 0){
      ans ++;
    }
    cout << ans << '\n';
    return 0;
} 


Measured memory_bytes: 1024
import math
n = int(input())
min_len = 10**11
for a in range(1,int(math.sqrt(n))+1):
  b = (n//a)
  if a * b == n:
    tmp = max(len(str(a)), len(str(b)))
    if tmp < min_len:
      min_len = tmp
print(min_len)

Measured memory_bytes: 3060
from collections import defaultdict

S = input()
N = len(S)
d = defaultdict(int)

ans = 0
curr = 0
d[0] += 1
for i in range(N):
    curr = int(S[N-1-i]) * pow(10, i, 2019) + curr
    curr %= 2019
    ans += d[curr]
    d[curr] += 1

print(ans)


Measured memory_bytes: 9644
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;

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


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T & a, const T & b) {
	if (a < b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T & a, const T & b) {
	if (a > b) {
		a = b;  // aをbで更新
		return true;
	}
	return false;
}


#define ARRAY_MAX 100005
const int INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

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


/******************************************************************************************/

vector<int> Edge[100005];
int check[100005][30];

int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);

	int V,E;
	cin >> V >> E;
	vector<char> A(V);
	string alpha = "abcdefghijklmnopqrstuvwxyz";
	for (int i = 0; i < V; i++)
	{
		cin >> A[i];
		if(A[i] != '?'){
			check[i][A[i]-'a'] = 1;
		}
	}
	
	for (int i = 0; i < E; i++)
	{
		int s,t;
		cin >> s >> t;
		Edge[s].push_back(t);
		Edge[t].push_back(s);
	}
	
	for (int i = 0; i < V; i++)
	{
		//今見ている頂点
		if(A[i] != '?')continue;
		for(auto letter:alpha){
			//埋め込むアルファベットの候補
			bool flag = true;
			if(check[i][letter-'a'])continue;
			for(auto nearId:Edge[i]){
				//周囲に既に使われていないかの確認
				//nearIdはインデックス番号
				if(check[nearId][letter-'a']){
					flag = false;
					break;
				}
			}
			
			if(flag){
				//cout << "i= " << i << " letter= " << letter << endl;
				//letterは使用可能
				check[i][letter-'a'] = 1;
				A[i] = letter;	
				/*for(auto nearId:Edge[i]){
					check[nearId][letter-'a'] = 1;
				}*/
				break;
			}
		}
	}
	for (int i = 0; i < V; i++)
	{
		cout << A[i];
	}
	
	cout << endl;
	return 0;
}




Measured memory_bytes: 21792
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

ll get(vector<ll> &v){
	if(SZ(v)&1) return v[SZ(v)/2];
	return (v[SZ(v)/2-1]+v[SZ(v)/2])/2;
}

int main(){FIN;
	int n; cin>>n;
	vector<ll> mn(n),mx(n);
	fore(i,0,n) cin>>mn[i]>>mx[i];
	if(n%2==0){
		fore(i,0,n) mn[i]*=2,mx[i]*=2;
	}
	sort(ALL(mn)); sort(ALL(mx));
	ll l=get(mn),r=get(mx);
	cout<<r-l+1<<"\n";
	
	
}

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

int main()
{
	int64_t n;
	cin >> n;
	vector<int64_t> as(n);
	for (auto &&a : as)
	{
		cin >> a;
	}

	sort(as.rbegin(), as.rend());

	int64_t ans = 0;

	for (int64_t i = 1; i < n; i++)
	{
		ans += as[i / 2];
	}

	cout << ans << endl;

	return 0;
}

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

const int MAX_N = 40;

ll w[MAX_N],v[MAX_N];

int n;
ll W;

pair<ll,ll> ps[1<<(MAX_N/2)];

void solve()
{
	int n2 = n/2;
	for(int i = 0;i<(1<<n2);i++)
	{
		ll sw = 0, sv = 0;
		for(int j = 0; j < n2;j++)
		{
			if(i >> j&1)
			{
				sw += w[j];
				sv += v[j];
			}
		}
		ps[i] = make_pair(sw,sv);
	}
	sort(ps,ps + (1<<n2));
	int m = 1;
	for(int i = 1;i< (1<<n2);i++)
	{
		if(ps[m-1].second<ps[i].second)
		{
			ps[m++] = ps[i];
		}
	}

	ll res = 0;
	for(int i = 0;i<(1<<(n-n2));i++)
	{
		ll sw = 0,sv = 0;
		for(int j = 0;j<n-n2;j++)
		{
			if(i>>j&1)
			{
				sw += w[n2 + j];
				sv += v[n2 + j];
			}
		}
		if(sw <= W)
		{
			ll tv = (lower_bound(ps,ps+m,make_pair(W-sw,LLONG_MAX))-1)->second;
			res = max(res,sv+tv);
		}
	}
	cout<<res<<endl;
}

int main()
{
	cin >> n >> W;
	for(int i = 0;i<n;i++)
	{
		cin >> v[i] >> w[i];
	}
	solve();
}


Measured memory_bytes: 19480
#include <bits/stdc++.h>	
#define pb push_back
typedef long long ll;
const int inf = 2e9;
using namespace std;

#define MAX 200005
#define MOD 1000000007

int n,m,k,t,q,p,a,b,c,x,y,minimo=inf,maximo;
ll ans = 0;
ll mod=1000000007;


int N[MAX];
int M[MAX];
//bool P[MAX];

//char M[MAX];

//char M[105][105];

//char M[1001][1001];



int main(){
	
	scanf("%d",&n);
	for (int i = 0; i < n; ++i) scanf("%d",&N[i]);
	int ans = 0;

	
	for (int i = 0; i < n ; ++i)
	{	
		M[N[i]] = 1;
		if(M[N[i]-1]) M[N[i]] = M[N[i]-1] + 1;
		ans = max(ans,M[N[i]]);
	}
	

	printf("%d\n", n-ans);
	return 0;

}



// Lee bien el problema (y es vocal? cuales son las restricciones?)
// CASOS ESPECIALES!! (n=1?) overflow (ll vs int?)

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
	ll x;
	cin>>x;
	return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 
 
vector <vector <int> > g;
vector <int> val;
vector <int> a;
 int dfs(vector <bool> &visited,int s);
 vector <int> test;
  vector <int> ans;
  void rerooting(int s,vector <bool> &visited);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a=nxtl(),b=nxtl(),c=nxtl();
    if((c-a-b)>0&&4*a*b<(c-b-a)*(c-b-a))
        cout<<"Yes\n";
    else
        cout<<"No\n";


    return 0;   
}


 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<ll> L(100);
    L.at(0) = 2;
    L.at(1) = 1;
    for (int i = 2; i <= N; ++i) {
        L.at(i) = L.at(i - 1) + L.at(i - 2);
    }
    cout << L.at(N) << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.Collectors;


public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        final int A=scanner.nextInt();
        final int B=scanner.nextInt();
        int max=Math.max(A,B);
        if(max<=8){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }

    }
}


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

using namespace std;

#define REP(i,m) for(int i=0; i<m; i++)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define INF 1000000007
#define INFL (1LL << 60)
#define MOD 998244353
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>


int main(){
	int n, m;
	cin >> n >> m;
	vector<int> s[m];
	int p[m];
	REP(i, m){
		int st;
		cin >> st;
		REP(j, st){
			int x;
			cin >> x;
			x--;
			s[i].pb(x);
		}
	}
	REP(i, m) cin >> p[i];
	int ans = 0;
	REP(i, 1<<n){
		bool f = true;
		REP(j, m){
			int c = 0;
			for(int sw: s[j]){
				c += (i >> sw)%2;
			}
			if(c%2 != p[j]) f = false;
		}
		if(f) ans++;
	}
	cout << ans << endl;
	return 0;
} 


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

int main() {
  string s; cin>>s;
  for ( int i = 0; i < 3; i++ ) {
    if ( s[i] == '1' ) s[i] = '9';
    else if ( s[i] == '9' ) s[i] = '1';
  }
  cout << s << endl;
  return 0;
}


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

int main(){
	
  	int A,B,C,D;
  	cin >> A >> B >> C >> D;
  	if(A<=B&&B<=C &&C<=D){
    	cout << 0 << endl;
      	return 0;
    }else if(C<=D&&D<=A &&A<=B){
    	cout << 0 << endl;
      	return 0;
    }else if(A<=C&&C<=B &&B<=D){
    	cout << B - C << endl;
      	return 0;
    }else if(C<=A&&A<=D &&D<=B){
    	cout << D - A << endl;
      	return 0;
    }else if(A<=C&&C<=D &&D<=B){
    	cout << D - C << endl;
      	return 0;
    }else if(C<=A&&A<=B &&B<=D){
    	cout << B - A << endl;
      	return 0;
    }

}

Measured memory_bytes: 256
# 2019/02/03
# AtCoder Beginner Contest117 - B

# Input
n = int(input())
l = list(map(int,input().split()))

# Choose Max
max = 0

for i in range(n):
    if l[i] > max:
        max = l[i]
        max_idx = i

# Sum
sum = 0
for j in range(n):
    if j != max_idx:
        sum += l[j]

if sum > max:
    ans = "Yes"
else:
    ans = "No"

# Output
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define PB push_back
#define MP make_pair
#define pri 1000000007
#define ftype  long double
#define endl '\n'
#define pr pair<ll,ll>
#define debug(x) cout<<#x<<" "<<x<<endl;
using namespace std;
ll vis1[100001]={0};
ll vis2[100001]={0};
ll vis3[100001]={0};
ll dp[100001]={0};

void bfs(ll ca,vector <ll> adj[]){
	queue <ll> cur;
	dp[ca]=0;
	cur.push(ca);
	vis3[ca]=1;
	while(!cur.empty()){
		ll c=cur.front();
		
			vector <ll> ass,ass2;
			for(auto j:adj[c])if(vis1[j]!=1){vis1[j]=1;ass.PB(j);}	
			for(auto p:ass){
				for(auto j:adj[p])
				if(vis2[j]!=1){vis2[j]=1;ass2.PB(j);}
			}		
			for(auto p:ass2){
				for(auto j:adj[p]){
					if(vis3[j]!=1){vis3[j]=1;cur.push(j);dp[j]=dp[c]+1;}
				}
			}
		cur.pop();	
		
	}
	
	
	
} 
void masterstroke(){
	ll n,m;cin>>n>>m;
	vector <ll> adj[n+1];
	for(ll i=0;i<m;i++){
		ll u,v;
		cin>>u>>v;
		adj[u].PB(v);
	}
	ll s,t;
	cin>>s>>t;
	bfs(s,adj);
	if(vis3[t])cout<<dp[t]<<endl;
	else cout<<-1<<endl;
	
}
int main(){
	 ios_base::sync_with_stdio(false);
	 cin.tie(NULL);
	 ll t=1;//cin>>t;
	 for(ll i=0;i<t;i++)masterstroke();
}

Measured memory_bytes: 8832
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll L[10101];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	L[0]=2;
	L[1]=1;
	for(i=2;i<=86;i++) L[i]=L[i-1]+L[i-2];
	cin>>x;
	cout<<L[x]<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;cin>>n;
    ll xary[n];
    rep(i,n) cin>>xary[i];
    ll yary[n];
    rep(i,n) yary[i] = xary[i];
    sort(yary, yary+n);
    ll chiisai = yary[n/2-1];
    ll ookii = yary[n/2];
    rep(i,n)
    {
        if (xary[i]<=chiisai)
        {
            cout << ookii;
        }
        else
        {
            cout << chiisai;
        }
        cout << endl;
    }
}


Measured memory_bytes: 5376
q=int(input())
a=[0]*(10**5+1)
sosu=set()
sosu={i for i in range(2,10**5+1)}
for i in range(2,10**5+1):
	if i in sosu:
		for j in range(i*2,10**5+1,i):
			if j in sosu:
				sosu.remove(j)
cnt=0
for i in range(1,10**5,2):
	if i in sosu and (i+1)//2 in sosu:
		cnt+=1
	a[i]=cnt
	a[i+1]=cnt
for i in range(q):
	r,l=map(int,input().split())
	print(a[l]-a[r-1])

Measured memory_bytes: 12652
h, w, k = map(int, input().split())
c = []
for i in range(h):
  c.append(list(input()))

ans = 0

for row in range(1 << h): #2^h - 1
  for col in range(1 << w): #2^w -1
    black = 0
    for i in range(h):
      for j in range(w):
        if (row >> i) & 1 == 0 and (col >> j) & 1 == 0 and c[i][j] =='#':
           black += 1
    if black == k:
      ans += 1

print(ans)


Measured memory_bytes: 73692
#include <cstdio>
#include <algorithm>

char s[100001];

int count(char d)
{
  const char digit[] = "010";
  const char* check = digit + d;
  int r = 0;
  for (int i = 0; s[i]; ++i)
  {
    if (s[i] != check[i & 1]) ++r;
  }
  return r;
}

int main()
{
  scanf("%s", s);
  printf("%d\n", std::min(count(0), count(1)));
  return 0;
}

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

int main(){

    int N;
    cin>>N;
    vector<int>vec(N+1, 0);
    for(int i=0;i<N;i++)cin>>vec[i];
    int ans = 0;
    for(int i=0;i<N;i++){
        while(vec[i]){
            int j = i;
            while(vec[j+1])j++;
            for(int k=i;k<=j;k++)vec[k]--;
            ans++;
        }
    }

    cout << ans <<endl;

    return 0;
}

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

int main(void) {
    i64 n, ans = 0;
    cin >> n;
    vector<i64> v(n), c(n);
    for (i64 i = 0; i < n; i++) cin >> v[i];
    for (i64 i = 0; i < n; i++) cin >> c[i];
    
    for (i64 b = 0; b < (1 << n); b++) {
        i64 now = 0;
        for (i64 i = 0; i < n; i++) {
            if (b & (1 << i)) {
                now += (v[i] - c[i]);
            }
        }
        ans = max(ans, now);
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
n,k = map(int,input().split(" "))
S = list(input())

s = S[k-1]
if s == "A" :
	S[k-1] = "a"
elif s == "B" :
	S[k-1] = "b"
else :
	S[k-1] = "c"

print("".join(S))

Measured memory_bytes: 3060
def main():
    s = input()
    s_len = len(s)

    flag = True
    flag &= s == s[::-1]
    if not flag:
        print('No')
        return
    sh = s[0:(s_len-1)//2]
    st = s[(s_len+3)//2-1:]
    flag &= sh == sh[::-1]
    flag &= st == st[::-1]
    if not flag:
        print('No')
    else:
        print('Yes')
    return

main()


Measured memory_bytes: 3060
#include <bits/stdc++.h> // Tomasz Nowak
using namespace std;     // XIII LO Szczecin
using LL = long long;    // Poland
#define FOR(i, l, r) for(int i = (l); i <= (r); ++i)
#define REP(i, n) FOR(i, 0, (n) - 1)
template<class T> int size(T &&x) {
	return int(x.size());
}
template<class A, class B> ostream& operator<<(ostream &out, const pair<A, B> &p) {
	return out << '(' << p.first << ", " << p.second << ')';
}
template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto it = x.begin(); it != x.end(); ++it)
		out << *it << (it == prev(x.end()) ? "" : ", ");
	return out << '}';
}
void dump() {}
template<class T, class... Args> void dump(T &&x, Args... args) {
	cerr << x << ";  ";
	dump(args...);
}
#ifdef DEBUG
  struct Nl{~Nl(){cerr << '\n';}};
# define debug(x...) cerr << (strcmp(#x, "") ? #x ":  " : ""), dump(x), Nl(), cerr << ""
#else
# define debug(...) 0 && cerr
#endif
mt19937_64 rng(0);
int rd(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rng);
}
// end of templates

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

	int a, b, c;
	cin >> a >> b >> c;
	swap(a, b);
	swap(a, c);
	cout << a << ' ' << b << ' ' << c << '\n';
}


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

signed main(){

    // omajinai
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    // omajinai

    int a,b,x;
    cin >> a >> b >> x;

    int ans = b / x - a / x + 1;
    if(a % x != 0) ans -= 1;

    cout << ans << endl;

}

Measured memory_bytes: 256