akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;


int main() {
	int a, b;
	vector<int> v;
	cin >> a >> b;
	v.push_back(a + b);
	v.push_back(a - b);
	v.push_back(a*b);

	//cout << v[0] << v[1] << v[2]<< endl; 
	cout << *max_element(v.begin(), v.end()) << endl;
	//cin >> a;
	return 0;
}

Measured memory_bytes: 256
n = int(input())
c = input()
left, right = 0, n - 1
cnt = 0
while left <= right:
    while left < n and c[left] == 'R':
        left += 1
    while right > -1 and c[right] == 'W':
        right -= 1
    if left == n or right == -1 or left >= right: break
    left += 1
    right -= 1
    cnt += 1
print(cnt)

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define ALL(name) name.begin(),name.end()
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 0
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

int N;
vector<int> A;

int solve() {
    // 下から取れる葉の min,max を測る
    vector< pair<int, int> > lim(N + 1);
    pair<int, int> cur = {A[N], A[N]};
    lim[N] = cur;
    for(int i = N - 1; i >= 0; --i) {
        // 最小
        lim[i].first = (lim[i+1].first + 1) / 2 + A[i];
        // 最大
        lim[i].second = (lim[i+1].second) + A[i];
        DBG("lim[%lld]: (%lld, %lld)\n", i, lim[i].first, lim[i].second);
    }
    if(lim[0].first > 1) {
        return -1;
    }

    int ret = 0;
    int border = 1;
    REP(i, N + 1) {
        if(i > 0) { border = border * 2; }
        DBG("i: %lld border: %lld lim[i]: (%lld, %lld)\n", i, border, lim[i].first, lim[i].second);
        int add = min(border, lim[i].second);
        DBG("add: %lld\n", add);
        ret += add;
        border = add - A[i];
    }

    return ret;
}

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

    cin >> N;
    A.resize(N + 1);
    REP(i, N + 1) {
        cin >> A[i];
    }

    int ans = solve();
    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 5552
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int a[101][101];
    int r,c,sum,sumc,sumall;
    cin>>r>>c;
    for(int i=0; i<r; i++){
        for(int j=0; j<c; j++){
            cin>>a[i][j];
        }
    }
    sumall=0;
    for(int i=0; i<r; i++){
        sum=0;
        for(int j=0; j<c; j++){
            sum=sum+a[i][j];
            cout<<a[i][j]<<' '<<flush;
        }
        sumall=sumall+sum;
        cout<<sum<<endl;
    }
    for(int j=0; j<c; j++){
        sumc=0;
        for(int i=0; i<r; i++){
            sumc=sumc+a[i][j];
        }
        cout<<sumc<<' ';
    }
    cout<<sumall<<endl;
}



Measured memory_bytes: 3088
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


ull E = 1000000007;

int main() {
    double T, X;
    cin >> T >> X;
    cout << T / X << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i, start, end) for(int i = start; i < end; i++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
const int MAX = 99999999;

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

    int e_sum[n] = {0};
    int w_sum[n] = {0};
    rep(i, n){
        e_sum[i] = (int)(inp[i] == 'E') + e_sum[max(0, i-1)];
        w_sum[i] = (int)(inp[i] == 'W') + w_sum[max(0, i-1)];
    }

    int min_val = MAX;
    repi(i, 0, n){
        int tmp = w_sum[i] + e_sum[n-1] - e_sum[i];
        if(i == 0) tmp --;
        min_val = min(tmp, min_val);
    }

    cout << min_val << endl;
}

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

#define ll long long
#define mk make_pair
#define pb push_back
#define fr first
#define sc second
#define vi vector < int >
#define pii pair < int, int >

const int N = 1e6 + 7;
const int INF = 1e9 + 7;

int dp[N], h[N];
int n, k;
int j;

main(){
    scanf("%d%d", &n, &k);
    for (int i = 1; i <= n; i++){
        scanf("%d", &h[i]);
    }
    for (int i = 2; i <= n; i++){
        dp[i] = dp[i - 1] + abs(h[i] - h[i - 1]);
        for (j = i - 2; j > 0 && i - j <= k; j--){
            dp[i] = min(dp[i], dp[j] + abs(h[i] - h[j]));
        }
    }
    printf("%d", dp[n]);
}


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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        //long a = sc.nextInt();
        String s = sc.next();
        //char c = s.charAt(s.length()-1);
        if(s.charAt(s.length()-1)=='s'){
            System.out.println(s+"es");
        }else{
            System.out.println(s+"s");
        }
        
    }
}


Measured memory_bytes: 38476
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#include <unistd.h>
#include <stdio.h>
#define all(a) (a).begin(),(a).end()
#define vecin(a) rep(i,a.size())cin >> a[i]
#define vecout(a) rep(i,a.size()){cout << a[i];cout << (i == a.size() - 1 ? "\n":" ");}
#define rep(i,x) for(int i = 0;i<x;i++)
#define REP(i,x) for(ll i = 1;i<=x;i++)
#define mp make_pair
using ll = long long;
using ld = long double;
using namespace std;
using dou = double;
const ll inf = 2147483647;
const ll INF = 1LL << 60;
const dou pi = 3.14159265358;
const ll mod = 1000000007LL;
//const ll mod = 998244353LL;
typedef pair<ll,ll> P;
using graph = vector<vector<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;}
template<class T> inline bool change(T a,T b){if(a > b){swap(a,b);return true;}return false;}
ll gcd(ll a,ll b){
    if(a < b)swap(a,b);
    if(a % b == 0)return b;
    else return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    return a / gcd(a,b) * b;
}

//素数判定O(sqrt(N))
bool isp(ll n){
    bool res = true;
    if(n == 1)return false;
    else{
        for(ll i = 2;i * i <= n;i++){
            if(n % i == 0){
                res = false;
                break;
            }
        }
        return res;
    }
}
const ll cmax = 1000000;
ll fac[cmax], finv[cmax], inv[cmax];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < cmax; i++){
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}

// 二項係数計算
ll nCk(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
//nのm乗をMODで割ったあまりO(logm)
ll modpow(ll n,ll m,ll MOD){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n) % MOD;
        m >>= 1;
        n *= n;
        n %= MOD;
    }
    return res;
}
ll mypow(ll n,ll m){
    if(m == 0)return 1;
    if(m < 0)return -1;
    ll res = 1;
    while(m){
        if(m & 1)res = (res * n);
        m >>= 1;
        n *= n;
    }
    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll N;
    cin >> N;
    cout << (N - 2) * 180 << endl;
}

Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll a, b;
  cin >> a >> b;
  if(a <= 8 && b <= 8) cout << "Yay!" << endl;
  else cout << ":(" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
ll mod = 1e9+7;
int main(){
	ios_base::sync_with_stdio(false);  
	cin.tie(NULL);
	int n;cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++){
		ll a;cin>>a;
		arr[i] = a;
	}
	ll maxi = *max_element(arr,arr+n);
	int count=0;
	for(int i=0;i<n;i++){
		if(arr[i]==maxi){
			count++;
		}
	}
	ll ans[n];
	memset(ans,0,sizeof(ans));
	if(count==1){
		ll maxi2 = 0;
		for(int i=1;i<n;i++){
			if(arr[i]<maxi){
				maxi2 = max(maxi2,arr[i]);
			}
		}
		for(int i=0;i<n;i++){
			if(arr[i]==maxi){
				ans[i] = maxi2;
			}
			else{
				ans[i] = maxi;
			}
		}
	}
	else{
		for(int i=0;i<n;i++){
			ans[i] = maxi;
		}
	}
	for(int i=0;i<n;i++){
		cout<<ans[i]<<endl;
	}
}


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

#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
#pragma ide diagnostic ignored "OCUnusedMacroInspection"
using namespace std;

#define sqr(a) ((a)*(a))
#define forn(i, n) for(int i = 0; i < (int)n; ++i)
#define rep(i, k, n) for(int i = (int)k; i <= (int)n; ++i)
#define nrof(i, n) for(int i = (int)n - 1; i >= 0; --i)
#define x first
#define y second
#define mp make_pair
#define sz(a) (int)(a.size())
#define pb push_back
#define eb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int N = 1e6 + 9;
const int M = 2e3 + 9;
const int INFINT = 1e9 + 9;
const ll INFLL = 1e18 + 9;
const ll MOD = (ll) (1000000007);

void solve() {
    int n;
    cin >> n;
    vector<ll> a(n);
    forn(i, n) cin >> a[i];
    ll curr = a[0];
    ll ans = 0;
    rep(i, 1, n - 1) {
        ans += max(0ll, curr - a[i]);
        curr = max(curr, a[i]);
    }
    cout << ans << endl;
}

int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 4780
N = int(input())
S = input()
target = "ABC"
j = 0
count = 0
for i in range(N):
    if S[i] == target[0]:
        j = 0
    if S[i] == target[j]:
        j += 1
    else:
        j = 0
    if j == 3:
        count += 1
        j = 0
print(count)
        



Measured memory_bytes: 9180
#include<bits/stdc++.h>
#define len(x) (int) (x.size())
using namespace std;
typedef long long ll;

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

    set<ll> myst;
    map<ll, ll> mymp;
    vector<ll> myvs;
    for(int i = 0; i < n; i++) {
        cin >> value;
        myvs.push_back(value);
        myst.insert(value);
        mymp[value]++;
    }
    
    ll total = 0;
    for(ll node : myst) {
        total += mymp[node]*(mymp[node]-1)/2;
    }

    for(int i = 0; i < len(myvs); i++) {
        ll ans = total;
        ans -= mymp[myvs[i]]*(mymp[myvs[i]]-1)/2;
        ans += (mymp[myvs[i]]-1)*(mymp[myvs[i]]-2)/2;

        cout << ans << '\n';
    }

    return 0;
}

Measured memory_bytes: 17008
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
#include<string.h>
#include<set>
#include<functional>
using namespace std;

#define INF 1<<21
#define MOD 1000000007

int main() {
  int m;
  int d[4] = { 10,50,100,500 };
  int c[4];
  int r[4];
  int flag = 1;

  while (1) {
	cin >> m;
	if (m == 0)return 0;

	int sum = 0;
	for (int i = 0; i < 4; i++) {
	  cin >> c[i];
	  sum += c[i]*d[i];
	  r[i] = 0;
	}

	sum -= m;
	for (int i = 3; i >= 0; i--) {
	  while (sum >= d[i]) {
		sum -= d[i];
		r[i]++;
	  }
	}
	if (flag==1) {
	  flag = 0;
	}
	else cout << endl;
	for (int i = 0; i < 4; i++) {
	  if (c[i] - r[i] > 0) {
		cout << d[i] << " " << c[i] - r[i] << endl;
	  }
	}
  }

}

Measured memory_bytes: 3096
#include<stdio.h>

int main(){
  int n[10];
  int i;
  for(i=0;i<10;i++){
    scanf("%d", &n[i]);
  }
  int max1=0;
  int i1=0;
  int max2=0;
  int i2=0;
  int max3=0;
  int i3=0;
  
  for(i=0;i<10;i++){
    if (max1 < n[i])
      {max1 = n[i];i1=i;}
  }
   
  for(i=0;i<10;i++){
    if (max2 < n[i] && i!=i1)
      {max2 = n[i];i2=i;}
  }

  for(i=0;i<10;i++){
    if (max3 < n[i] && i!=i1 && i!=i2)
      {max3 = n[i];i3=i;}
  }

  //printf("%d\n%d\n%d\n", i1, i2, i3);
  printf("%d\n%d\n%d\n", max1, max2, max3);
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

struct Point{
	double x,y;
	Point operator - (const Point a){
		Point res;
		res.x=x-a.x;
		res.y=y-a.y;
		return res;
	}
};

typedef Point Vector;

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

Vector v[4];

double c[4];

int main(){
	while (1){
		if (scanf("%lf,%lf,",&v[0].x,&v[0].y)==EOF) break;
		FOR(i,1,4){
			scanf("%lf,%lf,",&v[i].x,&v[i].y);
		}
		bool flg=true;
		REP(i,4){
			c[i]=cross(v[(i+1)%4]-v[i],v[(i+2)%4]-v[(i+1)%4]);
		}
		REP(i,4){
			if (c[i]*c[(i+1)%4]<0) flg=false;
		}
		if (flg){
			printf("YES\n");
		}
		else{
			printf("NO\n");
		}
	}
	return 0;
}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int s[1001]={0};
int x;
cin>>x;
s[1]=1;
s[2]=0;
for(int i=2;i<=1000;++i)
{
    int j=i*i;
    while(j<1001)
    {
        s[j]=1;
        j*=i;
    }
}
for(int i=x;i>=1;--i)
{
    if(s[i]==1)
    {
        cout<<i;
        break;
    }
}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (int)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;
    print(S[0] + to_string(len(S) - 2) + S.back());

    return 0;
}

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

int k, x;

int main() {
	cin >> k >> x;
	int s, g;

	s = x - k + 1;
	g = x + k - 1;
	for (int i = s; i <= g; i++) {
		cout << i << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
object Main extends App {

  for (i <- 1 to 9; j <- 1 to 9) yield TimesTable(i, j).print

  case class TimesTable(x: Int, y: Int) {
    val ans = x * y

    private def format: String = {
      s"${x}x${y}=${ans}"
    }

    def print = println(format)
  }

}

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

using namespace std;

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

int main()
{
  while(true){
    ll n, m;
    ll res = 0;
    cin >> n >> m;
    vector<ll> v(n, 0);
    if (n == 0 && m == 0) {
      return 0;
    }
    for (int i = 0; i < n; i++){
      cin >> v[i];
    }

    for (int i = 0; i < n; i++){
      for (int j = i+1; j < n; j++){
        if (v[i] + v[j] <= m && res <= v[i] + v[j]) {
          res = v[i] + v[j];
        }
      }
    }
    if (res == 0) {
      cout << "NONE" << endl;
    }else{
      cout << res << endl;
    }
  }
}



Measured memory_bytes: 3104
ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n = input()
l = len(n)
c = 0
for i in range(l):
    c= (c+int(n[i]))%9
f=False
if c==0:
    f=True
yn(f)


Measured memory_bytes: 9588
def A():
    temp = [int(i) for i in input().split()]
    ans = 0
    for n in temp:
        if n<4:
            ans += (4-n)*100000
    if temp[0] == 1 and temp[1] == 1:
        ans += 400000
    print(ans)

def B():
    N = int(input())
    lengths = [int(i) for i in input().split()]
    total = sum(lengths)
    temp_sum = lengths[0]
    ans = float('inf')
    for i in range(1, N):
        ans = min(ans, abs(total-2*temp_sum))
        #print(temp_sum)
        temp_sum += lengths[i]
    
    print(ans)
        
B()

Measured memory_bytes: 26220
use proconio::{fastout, input};

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: isize,
        v: [isize; 5],
    }

    let neck = v.iter().min().unwrap();
    let a = (n + (neck - 1)) / neck;
    let ans = a + 4;

    println!("{}", ans);
}


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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  for (auto& e : w) cin >> e;
  for (int i = 0; i + 1 < n; i++) w[i + 1] += w[i];
  int r = 1e9;
  for (int i = 0; i + 1 < n; i++) r = min(r, abs(w[i] - (w[n - 1] - w[i])));
  cout << r << endl;
}


Measured memory_bytes: 256
S = gets.chomp!
 
s1 = S[0]
 
if s1 == 'a' || s1 == 'b' || s1 == 'c'
  s2 = S[1]
  if s2 != s1 && (s2 == 'a' || s2 == 'b' || s2 == 'c')
    s3 = S[2]
    if s3 != s1 && s3 != s2
      if(s3 == 'a' || s3 == 'b' || s3 == 'c')
        puts 'Yes'
      else
        puts 'No'
      end
    else
     puts 'No'
    end
  else
     puts 'No'
  end
else
  puts 'No'
end

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

int main(){
    int N;
    int num[4];
    int bit, ans;

    cin >> N;
    for(int i=0; i<4; i++){
        num[3-i] = N % 10;
        N /= 10;
    }

    for(bit=0; bit<(1<<3); bit++){
        ans = num[0]; 
        for(int i=0; i<3; i++){
            if(bit & (1<<i)) ans += num[i+1];
            else ans -= num[i+1];
        }
        if(ans == 7) break;
    }

    for(int i=0; i<3; i++){
        cout << num[i];
        if(bit & (1<<i)) cout << "+";
        else cout << "-";
    }
    cout << num[3] << "=7" << endl;
}

Measured memory_bytes: 256
import sys
import math
import bisect
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


# A
def A():
    a = I()
    b = I()
    print(6 - a - b)
    return


# B
def B():
    n = I()
    s, t = input().split(' ')
    ans = []
    for i in range(n):
        ans.append(s[i])
        ans.append(t[i])
    print(''.join(ans))
    return


# C
def C():
    return


# D
def D():
    return


# E
def E():
    return


# F
def F():
    return


# Unittest
def resolve():
    B()
    return


# Solve
if __name__ == "__main__":
    B()


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    vector<llint> a(n+1);
    a.at(0) = 2;
    a.at(1) = 1;

    for(int in=2;in<=n;in++) {
        a.at(in) = a.at(in-1) + a.at(in-2);
    }
    cout << a.at(n) << endl;
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()


def main():
	s=input().rstrip().decode()+"T"
	x,y=MI()
	X=[]
	Y=[]

	i=0

	if s[0]=="F":
		for ss in s:
			if ss=="F":
				x-=1
				i+=1
			else:
				break
	#print(x,y,i)

	while True:
		ii=s.find("T",i+1)
		if ii==-1:
			break
		Y.append(ii-i-1)

		i=s.find("T",ii+1)
		if i==-1:
			break
		X.append(i-ii-1)
	#print(X,Y)


	s=set([0])
	ss=set()
	for i in X:
		for j in s:
			ss.add(j+i)
			ss.add(j-i)
		s=ss.copy()
		ss=set()
		#print(i,s,ss)
	#print(s)

	if x not in s:
		print("No")
		exit()

	s=set([0])
	ss=set()
	for i in Y:
		for j in s:
			ss.add(j+i)
			ss.add(j-i)
		s=ss.copy()
		ss=set()
	#print(s)

	if y not in s:
		print("No")
		exit()

	print("Yes")






















if __name__ == "__main__":
	main()


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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if(a > b) {
		if(a > c) {
			cout << b + c << endl;
		} else {
			cout << a + b << endl;
		}
	} else {
		if(b > c) {
			cout << a + c << endl;
		} else {
			cout << a + b << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import heapq


class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n + 1)]
        self.rank = [0] * (n + 1)

    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.parent[x] = y
        else:
            self.parent[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1

    def same_check(self, x, y):
        return self.find(x) == self.find(y)


n = int(input())
x_list = [(0, 0)] * n
y_list = [(0, 0)] * n
for i in range(n):
    x, y = map(int, input().split())
    x_list[i] = (x, i)
    y_list[i] = (y, i)
x_list.sort()
y_list.sort()
h = []
heapq.heapify(h)
for i in range(n - 1):
    x1, ix1 = x_list[i]
    x2, ix2 = x_list[i + 1]
    y1, iy1 = y_list[i]
    y2, iy2 = y_list[i + 1]
    heapq.heappush(h, (x2 - x1, ix1, ix2))
    heapq.heappush(h, (y2 - y1, iy1, iy2))

ans = 0
uf = UnionFind(n)
while h:
    w, s, t = heapq.heappop(h)
    if not uf.same_check(s, t):
        ans += w
        uf.union(s, t)
print(ans)

Measured memory_bytes: 55588
//g++ -std=c++14 test.cpp -o test.out
//入出力：http://kaitei.net/cpp/iostream/
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
using namespace std;

int N;
int a[100];
int ans_max = 0;
int ans_min = 0;

int bit_counter(int X){//Xの、立っているビットの数を返す
	int a = 0;
	while(1){
		a += X & 1;
		X = X >> 1;
		if(X==0) return a;
	}
}

void solve(){
	int flags = 0;//1桁目から順に　灰色がいるかどうか、茶色がいるかどうか、、、、と続く
	int numof_over3200 = 0;//3200以上の人の数
	for(int i=0;i<N;i++){
		if(a[i]>=3200){
			numof_over3200++;
		}
		else{
			int digit = a[i]/400;
			flags |= (1<<digit);
		}
	}

	int numof_under3200 = bit_counter(flags);
	if(numof_under3200>0){
		ans_min = numof_under3200;
		ans_max = ans_min + numof_over3200;
		return;
	}
	ans_min = 1;
	ans_max = numof_over3200;
}

int main(){
	cin >> N;
	for(int i=0;i<N;i++) cin >> a[i];

	solve();

	cout << ans_min << ' ' << ans_max;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,s=0,i,j,d[100010];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&d[i]);
    for(j=0;j<i;j++)s+=d[i]*d[j];
  }
  printf("%d\n",s);
  return 0;
}
  


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e2 + 5;
const int INF = 1e9 + 7;

int k;
string s;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> k >> s;
	if (s.size() > k)
		cout << s.substr(0, k) << "...";
	else
		cout << s;
	return 0;
}
//10-09-2020 21:22:41

Measured memory_bytes: 3588
from fractions import gcd
a, b, c, d = list(map(int, input().split()))
#b = list(map(int, input().split()))
total = b-a+1
lcm = int((c*d)/gcd(c, d))

d1 = b//c - a//c
d2 = b//d - a//d
add = b//lcm - a//lcm
if a % c == 0:
    d1 += 1
if a % d == 0:
    d2 += 1
if a % lcm == 0:
    add += 1

print(total-d1-d2+add)


Measured memory_bytes: 5220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] abc = {sc.nextInt(),sc.nextInt(),sc.nextInt()};
		int k = sc.nextInt();

		int max = 0;
		int maxIndex = 0;
		for(int i = 0; i < 3;i++){
			if(max < abc[i]){
				maxIndex = i;
				max = abc[i];
			}
		}

		int ans = 0;
		for(int i = 0; i < 3; i++){
			if(i == maxIndex){
				int a = abc[i];
				for(int x = 0; x < k; x++){
					a = a * 2;
				}
				ans += a;
			}else{
				ans += abc[i];
			}
		}
		System.out.println(ans);

	}
}


Measured memory_bytes: 21716
n, m = map(int, input().split())
l = [''] * n
ans = 0
for i in range(m):
  s, c = map(int, input().split())
  if ans == 0:
    if s == 1 and c == 0 and n >= 2:
      ans = -1
    else:
      if l[s - 1] == '':
        l[s - 1] = c
      elif l[s - 1] != '' and l[s - 1] == c:
        next
      elif l[s - 1] != '' and l[s - 1] != c:
        ans = -1
if ans == 0:
  ans = ''
  if n == 1 and m == 0:
    ans = 0
  else:
    for i  in range(len(l)):
      if l[i] == '' and i != 0:
        l[i] = 0
      elif l[i] == '' and i == 0:
        l[i] = 1 
      ans += str(l[i])
print(ans)

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

int main() {
    int n; cin >> n;
    bool flag = true;
    bool mod2 = false;
    vector<long long> x(n), y(n), u(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
        u[i] = x[i] + y[i];
        v[i] = x[i] - y[i];
        if (abs(u[i]) % 2 != abs(u[0]) % 2) flag = false;
    }
    mod2 = u[0] % 2;

    if (flag == false) {
        cout << -1 << endl;
        return 0;
    }

    vector<long long> d;
    for (int i = 0; i < 33; i++) {
        d.push_back(pow(2, 32-i));
    }
    if (!mod2) {
        d.push_back(1);
    }
    cout << d.size() << endl;
    for (int i = 0; i < d.size(); i++) {
        if (i != 0) cout << " ";
        cout << d[i];
    }
    cout << endl;

    for (int i = 0; i < n; i++) {
        if (!mod2) {
            u[i]--; v[i]--;
        }
        for (int j = 0; j < 33; j++) {
            bool p, q;
            if (abs(u[i]-d[j]) < abs(u[i]+d[j])) {
                p = true; u[i] -= d[j];
            } else {
                p = false; u[i] += d[j];
            }
            if (abs(v[i]-d[j]) < abs(v[i]+d[j])) {
                q = true; v[i] -= d[j];
            } else {
                q = false; v[i] += d[j];
            }
            if (p && q) cout << "R";
            else if (p && !q) cout << "U";
            else if (!p && q) cout << "D";
            else if (!p && !q) cout << "L";
        }
        if (!mod2) cout << "R" << endl;
        else cout << endl;
    }
    return 0;
}

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

#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

#define M 998244353

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    fast;
    ll n, k;
    cin >> n >> k;
    ll m = pow(2, n) - 1;
    if (k > m || m == 1 && k == 1) {
        cout << -1 << endl;
        return 0;
    }
    vi el;
    REP(i, 1, m+1) {
        if (i != k)
            el.pb(i);
    }
    if (k != 0)
        cout << "0 " << k << " 0 ";
    else
        cout << "0 0 ";
    REP(i, 0, el.size())
        cout << el[i] << " ";
    if (k != 0)
        cout << k << " ";
    RREP(i, el.size() - 1, -1)
        cout << el[i] << " ";
    cout << endl;
    return 0;
}


Measured memory_bytes: 2932
#include<stdio.h>
#include<algorithm>
using namespace std;
struct look{int a,b;
}k[200010];
bool cmp(look a,look b)
{
	return a.b!=b.b?a.b<b.b:a.a<b.a;
} 
int main()
{
	int n,i,t;
	while(~scanf("%d",&n))
	{
		for(i=1;i<=n;i++)
		    scanf("%d%d",&k[i].a,&k[i].b);
		sort(k+1,k+1+n,cmp);
		int p=0;
		for(i=1;i<=n;i++)
		    if(p+k[i].a<=k[i].b)
		    {
		    	p+=k[i].a;
		    	t=1;
			}
			else
			{
				t=0;
				break;
			}
		if(t==1)printf("Yes\n");
		else printf("No\n");		    
	}
}

Measured memory_bytes: 1664
import sys
from itertools import accumulate
from bisect import bisect_left

n, m, *a = map(int, sys.stdin.read().split())
a.sort()


def f(x):
    # 幸福度がx未満となる組み合わせの個数を数える
    cnt = 0
    for ai in a:
        cnt += bisect_left(a, x-ai)
    # 幸福度がx以上の組み合わせの個数がm未満かどうか
    return n * n - cnt < m


left = a[0] * 2
right = a[-1] * 2
while right - left > 1:
    mid = (right + left) // 2
    if f(mid):
        right = mid
    else:
        left = mid
ans = 0
cumsum = [0] + list(accumulate(a))
j = 0
for ai in a:
    i = bisect_left(a, left-ai)
    j += n - i
    ans += ai * (n - i) + cumsum[-1] - cumsum[i]
ans += (m - j) * left
print(ans)


Measured memory_bytes: 64196
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

int main() {
  int n;
  scanf("%d", &n);
  vi a(n);
  vi num_of_d(n-1, 0);
  rep (i, n) {
    scanf("%d", &a[i]);
    num_of_d[a[i]] += 1;
  }
  sort(all(a));
  int max_d = a.back();
  int min_d = (max_d + 1) / 2;
  rep (i, min_d) {
    if (num_of_d[i] != 0) {
      printf("Impossible\n");
      return 0;
    }
  }
  if ((max_d&1) == 0) {
    if (num_of_d[min_d] != 1) {
      printf("Impossible\n");
      return 0;
    }
  } else {
    if (num_of_d[min_d] != 2) {
      printf("Impossible\n");
      return 0;
    }
  }
  FOR (i, min_d + 1, max_d + 1) {
    if (num_of_d[i] < 2) {
      printf("Impossible\n");
      return 0;
    }
  }
  printf("Possible\n");

  return 0;
}


Measured memory_bytes: 632
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
 
const ll INF=1e9+7;

int main(){
    ios;
    ll n;
    cin >> n;
    set<string> t;
    vector<string> s(n);
    rep(i,n){
        cin >> s[i];
        t.insert(s[i]);
    }
    cout << t.size() << endl;
    return 0;
} 

Measured memory_bytes: 25060
<?php
$input = trim(fgets(STDIN));

$divide = floor($input / 1.08);

if(floor($divide * 1.08) == $input){
  echo $divide;
} elseif(floor(($divide - 1) * 1.08) == $input){
  echo $divide - 1;
} elseif(floor(($divide + 1) * 1.08) == $input){
  echo $divide + 1;
} else {
  echo ":(";
}
?>

Measured memory_bytes: 3576
use std::io::*;
use std::str::FromStr;


fn main() {
    let mut s = read::<String>().chars().collect::<Vec<_>>().into_iter();
    let mut s: Vec<_> = (0..).zip(s).collect();
    let mut ans: String;
    
    for (i,j) in s{
		if  i % 2 == 0 { print!( "{}", j ) } 
    }
    std::io::stdout().flush().unwrap();
}

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}


Measured memory_bytes: 4352
a = int(input())

def f(a):
  if a%2 == 0:
    return a // 2
  else:
    return 3*a + 1

S = set()
S.add(a)
c = 2
while True:
  a = f(a)
  if a in S:
    break
  else:
    S.add(a)  
  c += 1

print(c)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
const int kN = 1e5+10;
struct Node{
	int t, x, y;
}a[kN];
int main() {
	int n; scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d%d%d", &a[i].t, &a[i].x, &a[i].y);
	}
	a[0].t = a[0].x = a[0].y = 0;
	for (int i = 1; i <= n; ++i) {
		int dis = std::abs(a[i].x-a[i-1].x)+std::abs(a[i].y - a[i-1].y);
		if (a[i].t-a[i-1].t < dis || (a[i].t-a[i-1].t)%2 != dis%2) {
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

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

class Main {

	static int[][] dp;
	static String x;
	static String y;

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

		int n = Integer.parseInt(br.readLine());

		for (int ds=0; ds<n; ds++) {
			x = br.readLine();
			y = br.readLine();

			int xLen = x.length();
			int yLen = y.length();
			dp = new int[xLen+1][yLen+1];

			System.out.println(rec(xLen,yLen));
		}


		br.close();
	}

	static int rec(int i,int j){
		if (dp[i][j] != 0)
			return dp[i][j];
		if (i==0 || j==0)
			return 0;
		if (x.charAt(i-1) == y.charAt(j-1))
			return dp[i][j] = rec(i-1,j-1)+1;
		else
			return dp[i][j] = Math.max(rec(i-1,j),rec(i,j-1));
	}
}

Measured memory_bytes: 73952
#include <iostream>
#include "stdio.h"
#include "algorithm"
using namespace std;

int main(int argc, char *argv[])
{
	int n,m,l;
	while(cin>>n>>m>>l)
	{
		int a[3];
		a[0] = n;
		a[1] = m;
		a[2] = l;
		sort(a, a+3);
		printf ("%d\n",a[2] * 10 +a[1]+ a[0]);
	}
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

int a = 0;
int b = 0;

int squ = 0;
int len = 0;

scanf("%d %d",&a,&b);

squ = a * b;
len = a + a + b + b;

printf("%d %d\n",squ,len);

return 0;

}


Measured memory_bytes: 2052
object Main extends App {
	val n = scala.io.StdIn.readInt
	val w = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	val p = new Array[Int](n)

	p(0) = w(0)

	for(i<-1 until n){
		p(i) = p(i-1) + w(i)
	}

	val sum_w = w.sum
	var ans = Int.MaxValue

	for(i<-1 until n-1){
		ans = math.min(ans, math.abs(sum_w - 2*p(i)))
	}

	println(ans)

}

Measured memory_bytes: 25416
c=[]
3.times do
  c << gets.split.map(&:to_i)
end
if c[0][1]-c[0][0]==c[1][1]-c[1][0]&&c[1][1]-c[1][0]==c[2][1]-c[2][0]&&c[0][2]-c[0][1]==c[1][2]-c[1][1]&&c[1][2]-c[1][1]==c[2][2]-c[2][1]&&c[1][0]-c[0][0]==c[1][1]-c[0][1]&&c[1][1]-c[0][1]==c[1][2]-c[0][2]&&c[2][0]-c[1][0]==c[2][1]-c[1][1]&&c[2][1]-c[1][1]==c[2][2]-c[1][2]
  puts "Yes"
else
  puts "No"
end


Measured memory_bytes: 14352
bus_link = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 3, 2, 1]

n = gets.chomp.to_i

n.times do
  a, b = gets.chomp.split.map(&:to_i)

  answer = []
  min_size = Float::INFINITY
  for i in 0...bus_link.size
    next if a != bus_link[i]
    start_index = i
    for j in (i + 1)...(i + bus_link.size)
      j %= bus_link.size
      next if b != bus_link[j]
      last_index = j
      if  start_index > last_index
        c = bus_link[start_index...bus_link.size] + bus_link[0..last_index]
      else
        c = bus_link[start_index..last_index]
      end

      if c.size < min_size
        min_size = c.size
        answer = c
      end

      break
    end
  end

  puts answer.join(' ')
end

Measured memory_bytes: 8656
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int no_ofheight;
    cin>>no_ofheight;
    int heights[no_ofheight];
    for(int i=0;i<no_ofheight; i++){
        cin>>heights[i];
    }
    int ans_assume=1;
    for(int i=0;i<no_ofheight-1;i++){
        if(heights[i+1]>heights[i]){
            //false
            --heights[i+1];

        }
        else if(heights[i+1]<heights[i]){
             ans_assume=0;
        }
    }
    if(ans_assume==1){
        cout<<"Yes"<<endl;

    }
    else
    {
        cout<<"No"<<endl;
    }

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

int main()
{
    deque<int> deq;
    int n;
    cin >> n;

    rep(i, n)
    {
        int a;
        cin >> a;
        i % 2 == 0 ? deq.push_back(a) : deq.push_front(a);
    }

    if (n % 2 == 0)
    {
        rep(i, n)
        {
            if (i)
                cout << " ";
            cout << deq.front();
            deq.pop_front();
        }
    }
    else
    {
        rep(i, n)
        {
            if (i)
                cout << " ";
            cout << deq.back();
            deq.pop_back();
        }
    }

    return 0;
}

Measured memory_bytes: 2944
#include <stdio.h>

int main(void)  {
  int a, b;
  scanf("%d %d", &a, &b);
  
  if (a > b)
    printf("a > b\n");

  else if (a < b)
    printf("a < b\n");

  else if (a == b)
    printf("a == b\n");

  return 0; 
}

Measured memory_bytes: 1816
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"sort"
	"strconv"
)

type Heap struct {
	data []int
}

func (h *Heap) Len() int           { return len(h.data) }
func (h *Heap) Less(i, j int) bool { return h.data[i] < h.data[j] }
func (h *Heap) Swap(i, j int)      { h.data[i], h.data[j] = h.data[j], h.data[i] }
func (h *Heap) Push(i interface{}) { h.data = append(h.data, i.(int)) }
func (h *Heap) Pop() interface{} {
	i := h.data[len(h.data)-1]
	h.data = h.data[:len(h.data)-1]
	return i
}

type Data struct {
	b, c int
}
type DataSlice struct {
	data []*Data
}

func (s DataSlice) Len() int           { return len(s.data) }
func (s DataSlice) Swap(i, j int)      { s.data[i], s.data[j] = s.data[j], s.data[i] }
func (s DataSlice) Less(i, j int) bool { return s.data[i].c > s.data[j].c }

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)

	n, m := oneInt(), oneInt()
	input := scanNums(n)

	dataSlice := &DataSlice{[]*Data{}}
	for i := 0; i < m; i++ {
		b, c := oneInt(), oneInt()
		dataSlice.data = append(dataSlice.data, &Data{b, c})
	}

	h := calc(input, dataSlice)

	sum := 0
	for _, v := range h.data {
		sum += v
	}
	fmt.Println(sum)

}

func calc(input []int, dataSlice *DataSlice) *Heap {
	h := &Heap{}
	heap.Init(h)
	for _, a := range input {
		heap.Push(h, a)
	}

	sort.Sort(dataSlice)
	for _, d := range dataSlice.data {
		for i := 0; i < d.b; i++ {
			if m, ok := heap.Pop(h).(int); ok {
				if m < d.c {
					heap.Push(h, d.c)
				} else {
					heap.Push(h, m)
					return h
				}
			}
		}
	}
	return h
}

func oneInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return
}


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

 int main(){
     int N; long K;cin>>N>>K;
     vector<pair<long,long>> v(N);
     for(int i=0;i<N;i++){
         cin>>v.at(i).first>>v.at(i).second;
    }
    sort(v.begin(),v.end());

    long sum=0;
    long res=0;
    for(int i=0;i<N;i++){
        sum += v.at(i).second;
        if(sum>=K){
            res=v.at(i).first;
            break;
        }
    }
    cout<<res<<endl;
    return 0;
 }

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

int main(){
    int N;
    int sum = 0;
    int l,r;
    cin >> N;
    rep(i, N){
        cin >> l >> r;
        sum += r - l + 1;
    }
    cout << sum << endl;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  deque<int> q;
  
  rep(i,n){
    int p = lower_bound(q.begin(),q.end(),a[i]) - q.begin();
    if(p==0){
      q.push_front(a[i]);
    }else{
      q[p-1] = a[i];
    }
  }
  int ans = q.size();
  cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <vector>
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;


const int MAX_N = 200000;
int N;
int K;
//ll A[MAX_N];
vector<int> A(MAX_N);


void Main() {
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
    A[i]--;
  }

  vector<int> S(MAX_N);
  for (int i = 0; i < N; ++i) {
    S[i + 1] = (S[i] + A[i]) % K;
  }

  map<int, int> rec;
  ll ans = 0;
  queue<int> q;
  for (int i = 0; i < N + 1; ++i) {
    ans += rec[S[i]];
    rec[S[i]]++;
    q.push(S[i]);
    while (q.size() >= K) {
      rec[q.front()]--;
      q.pop();
    }
  }

  cout << ans << endl;
}

int main() {
  Main();
  return 0;
}

Measured memory_bytes: 12032
N, K = [int(_) for _ in input().split()]
S = input()
O = [[0, 0]]
is1 = False
for i in range(N):
    if S[i] == '1':
        if not is1:
            O += [[i, N]]
        is1 = True
    elif S[i] == '0':
        if is1:
            O[-1][-1] = i
        is1 = False
O += [[N, N]]
K = min([len(O) - 1, K])
ans = 0
for i in range(len(O) - K):
    ans = max([ans, O[i + K][1] - O[i][0]])
print(ans)


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

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

  int Happy=0;
 
  while(N>=500){
  	N=N-500;
    Happy+=1000;
  }
  
  
  
  Happy=Happy+N-N%5;
  
  cout << Happy <<endl;
 
}




Measured memory_bytes: 256
from collections import deque
n = int(input())
A = sorted(list(map(int, input().split())))[::-1]

deq = deque([A[0]])
ans = 0
for x in A[1:]:
    ans += deq.popleft()
    deq.append(x)
    deq.append(x)
print(ans)

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
	int n;
	cin >> n;
	n %= 10;
	if (n == 2 || n == 4 || n == 5 || n == 7 || n == 9) cout << "hon" << "\n";
	else if (n == 0 || n == 1 || n == 6 || n == 8) cout << "pon" << "\n";
	else if (n == 3) cout << "bon" << "\n";
	return 0;
}


Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>
#define Matd vector<vector<ld>>
#define Arrd vector<ld>

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    Arr freq(26, 0);
    forn(i, 4) freq[s[i] - 'A']++;
    forn(i, 26) if(freq[i] != 2 && freq[i] != 0) return cout << "No" << endl, 0;
    cout << "Yes" << endl;
    return 0;
}

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

A = [int(i) for i in input().split()]

cur = 0
m_max = 0
for i in range(len(A)-1):
	if A[i+1] <= A[i]:
		cur += 1
	else:
		cur = 0
	if cur > m_max:
		m_max = cur
print(m_max)

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

long long N;
vector<long long> A;

int Atack(vector<long long> monster) {
    if(monster.size() == 1) return monster[0];

    int n = monster.size();
    vector<long long>::iterator miniter = min_element(monster.begin(), monster.end());
    int minindex = distance(monster.begin(), miniter);
    vector<long long> next;
    for (int i = 0; i < n; i++) {
        if (i == minindex) next.push_back(monster[i]);
        else if (monster[i] % monster[minindex] != 0) next.push_back(monster[i] % monster[minindex]);
    }

    return Atack(next);

}

int main() {
    scanf("%Ld", &N);
    A.resize(N);
    for (int i = 0; i < N; i++) scanf("%Ld", & A[i]);
    int ans = Atack(A);
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 3444
#include <bits/stdc++.h>
#include<string.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))
#define fr(i,s,e) for(i=s;i<e;i++)
#define rf(i,s,e) for(i=s-1;i>=e;i--)
#define pb push_back
#define eb emblace_back
#define mp make_pair
#define ff first
#define ss second
#define int   long long
#define ll   long long
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define vl vector<long long>
#define inf (1LL<<61)
#define vi vector<int> 
#define vii vector< vector<int> >
#define vll vector< vector<long long> >
#define vpi vector< pair<int,int> >   
#define vpl vector< pair<ll,ll> >   
#define viii vector< vector<vector<int> > >
typedef pair<pair<int, int>,int> P;
#define mod %1000000007
#define pi 3.14159265358979323846//20 decimals
#define ld long double

bool comp(pair<int,int> p1,pair<int,int> p2)
{
    if(p1.ff!=p2.ff)
        return p1.ff<p2.ff;
    else
        return p1.ss<p2.ss;
}

int32_t main()
{                
    IOS;
    /*#ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif*/
    int n,m,d;
    cin>>n>>m>>d;
    cout<<fixed<<setprecision(12);
    ld p;
    if(d==0)
    {
        p=(ld)1/(ld)n;
    }
    else
    {
        if(n>=2*d)
        p=((ld)(n-2*d)/(ld)n)*((ld)2)/((ld)n)+(ld)(2*d)/(ld)(n*n);
    else
        p=(ld)1/(ld)n;
    }
    //trace1(p);
    cout<<(ld)(m-1)*p;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

A = [[0 for i in range(m)]for j in range(n)]
B = [0 for i in range(m)]
Anser = [0 for i in range(n)]

for i in range(n):
    A[i] = list(map(int,input().split()))

for i in range(m):
    B[i] = int(input())

for i in range(n):
    for j in range(m):
        Anser[i] += A[i][j]*B[j]
    print(Anser[i])



Measured memory_bytes: 6028