akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <map>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <cmath>
#include <queue>
#include <ctime>
#include <utility> // std::pair
#include <functional> // std::greater <int> ()
#define int long long
#define MAXN 500000 // check
#define inf 1000000000000000001
#define BASE 29 // hashings mod, can be rand'd
#define mod 998244353 // can be 1000000007
#define pi 3.1415926535897
#define pii pair <int, int>
#define fii first
#define see second

typedef long long ll;
typedef long double ld;
using namespace std;

int n;
int cnt, tmp;

// functions
void input(){
	cin >> n;
	cnt=0;
	for(int i=1; i<=n; i++)
	{
		cin >> tmp;
		if(tmp!=i)
		{
			cnt++;
		}
	}
	return;
}

void solve(){
	if(cnt!=2 && cnt!=0) cout << "NO";
	else cout << "YES";
	return;
}

void output(){
	return;
}

signed main(){
/*
//  REMEMBER TO TURN OFF IFDEF IN PROBLEMS WITH FILE I/O
*/
#ifdef sheeep
	freopen("forces.inp", "r", stdin);
	freopen("forces.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
//	int t;
//	cin >> t;
//	for(int i=1; i<=t; i++){
		input();
		solve();
		output();
	//}
	return 0;
}
// Author: NamSPro

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

ll comb(int n, int r){
    ll num = 1;
    FOR(i, 1, r){
        num = num * ((ll)n - i + (ll)1)/(ll)i;
    }

    return num; 
}

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

    int A[N];
    map<int, int> mp;
    REP(i, N){
        cin >> A[i];
        mp[A[i]]++;
    }

    map<int, ll> mp2;
    map<int, ll> mp3;
    ll all = 0;
    for (const auto& [key, value] : mp){
        mp2[key] = comb(value, 2);
        mp3[key] = comb(value-1, 2);
        all += mp2[key];
    }

    REP(i, N){
        ll ans;
        ans = all - mp2[A[i]] + mp3[A[i]];
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 26172
#include<stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp
{
	char name[100];
	int t;
}P;

P Q[LEN];
int head,tail,n;

void enqueue(P x)
{
	Q[tail] = x;
	tail = (tail + 1) % LEN;
}

P dequeue()
{
	P x = Q[head];
	head = (head+1)%LEN;
	return x;
}



int min(int a, int b)
{
	return a<b ? a :b;
}


int main()
{
	int elaps= 0,c;
	int i,q;
	P u;
	scanf("%d %d",&n,&q);
	
	for(i = 1;i<=n;i++)
	{
		scanf("%s", Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head = 1; tail = n + 1;
	
	while(head != tail)
	{
		u = dequeue();
		c = min(q,u.t);
		u.t -=c;
		elaps +=c;
		if(u.t>0) enqueue(u);
		else{
			printf("%s %d\n",u.name,elaps);
		}
	}
	return 0;
}


Measured memory_bytes: 11908
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> w(n);
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> w[i];
		sum += w[i];
	}
	int m = 100000;
	for (int i = 0; i < n; i++) {
		int s = 0;
		for (int j = 0; j < n-1; j++) {
			s += w[j];
			m = min(m, abs(s - (sum - s)));
		}
	}
	cout << m << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
         
        int[] p = new int[3];
        int[] j = new int[2];
        p[0] = stdIn.nextInt();
        p[1] = stdIn.nextInt();
        p[2] = stdIn.nextInt();
        j[0] = stdIn.nextInt();
        j[1] = stdIn.nextInt();
        Arrays.sort(p);
        Arrays.sort(j);
        System.out.println(p[0]+j[0]-50);
    }
}

Measured memory_bytes: 17224
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>

using ll = unsigned long long;
using namespace std;

int main(void) {
    int n;
    cin >> n;
    int out = 3 * pow(n,2);

    cout << out << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define ll long long
#define pii pair<int,int>

int N;
vector<int> ans[100010];

int main(){
    cin >> N;
    int k = 1;
    while(k * (k + 1) < 2 * N) k++;
    if(k * (k + 1) != 2 * N){
        cout << "No" << endl;
        return 0;
    }
    cout << "Yes" << endl;
    cout << k + 1 << endl;
    int idx = 1;
    for(int i = 0; i <= k; i++){
        for(int j = 1; j <= k;j++){
            if(ans[i].size() == k) break;
            ans[i].push_back(idx);
            ans[i + j].push_back(idx++);
        }
    }
    for(int i = 0; i <= k; i++){
        cout << k << " ";
        for(auto &u : ans[i]){
            cout << u << " ";
        }
        cout << endl;
    }
    return 0;
}

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

int main()
{
   string str;
   long long int a;
   
   cin>> str;
   
   for (int i = 0; i < str.size(); ++i) {
       a = a + str[i]-'0';
    }
    cout<<(a%9==0?"Yes":"No")<<endl;
    
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <stack>
#include <map>
#include <iomanip>
using namespace std;

int main(){
    int n ;
    cin >> n ;
    vector<string> s(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> s.at(i) ;
    }
    sort(s.begin(),s.end()) ;
    int ans = 1 ;
    for (size_t i = 0; i < n-1; i++)
    {
        if (s.at(i) != s.at(i+1))
        {
            ans ++ ;
        }
        
    }
    
    cout << ans << endl ;
}

Measured memory_bytes: 9548
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<int> D(N);
	for (auto& x : D) cin >> x;
	int M;
	cin >> M;
	vector<int> T(M);
	for (auto& x : T) cin >> x;

	multiset<int> a;
	for (auto x : D) a.insert(x);

	for (auto x : T) {
		auto it = a.find(x);
		if (it == a.end()) {
			cout << "NO" << endl;
			return 0;
		}
		a.erase(it);
	}
	cout << "YES" << endl;
}


Measured memory_bytes: 11136
x,k,d=map(int,input().split())
if x<0:
    x=-1*x
n=x//d
ans=x
if n>=k:
    ans-=k*d
elif (k-n)%2==0:
    ans-=n*d
else:
    ans-=(n+1)*d

print(abs(ans))


Measured memory_bytes: 61656
#include <stdio.h>

int main(void)
{
	int m[100],f[100],r[100];
	char ans[100];
	int i=0,j,sum=0,a;
	
	while(1){
		scanf("%d %d %d",&m[i],&f[i],&r[i]);
		if(m[i]==-1 && f[i]==-1 && r[i]==-1) break;
		else i++;
	}
	a=i;
	for(j=0 ; j<i ; j++){
		sum=m[j]+f[j];
		if(m[j]==-1 || f[j]==-1){
			ans[j]='F';
		}
		else if(sum>=80){
			ans[j]='A';
		}
		else if(sum>=65){
			ans[j]='B';
		}
		else if(sum>=50){
			ans[j]='C';
		}
		else if(sum>=30){
			if(r[j]>=50)
				ans[j]='C';
			else ans[j]='D';
		}
		else ans[j]='F';
		sum=0;
	}
	
	for (i=0 ; i<a ; i++)
		printf("%c\n",ans[i]);
	
	return 0;
}


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

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    for (int i = 0;i < n;i++){
        cin >> x.at(i);
    }
    int ans = 0;
    for (int i = 0;i < n;i++){
        int A = x.at(i)*2;
        int B = (k - x.at(i))*2;
        ans += min(A,B);
    }   
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

struct Node{
    public:
        int num;
        vector<Node> nodes;
        int need()const{
            if(nodes.size()==0) return num/2+1;
            else{
                vector<int> v;
                for(auto& node : nodes){
                    v.emplace_back(node.need());
                }
                sort(all(v));
                int ret = 0;
                for(int i=0;i<(v.size()+1)/2;i++){
                    ret += v[i];
                }
                return ret;
            }
        }
};

Node parse(const string& s,int& cur){
    assert(s[cur]=='[');
    if(s[cur+1]=='['){
        cur++;
        Node ret;
        while(cur < s.size() and s[cur]=='['){
            ret.nodes.emplace_back(parse(s,cur));
        }
        assert(s[cur]==']');
        cur++;
        return ret;
    }else{
        cur++;
        int num = 0;
        while(s[cur]!=']'){
            num = num * 10 + s[cur]-'0';
            cur++;
        }
        assert(s[cur]==']');
        cur++;
        Node ret;
        ret.num = num;
        return ret;
    }
}

void solve(){
    string s; cin >> s;
    int n = s.size();
    int cur=0;
    Node root = parse(s,cur);
    cout << root.need() << endl;
}

int main(){
    int n;
    cin >> n;
    rep(i,n) solve();
}



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

int main()
{
	int n, m; scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; ++i) 
		if (2 * i < m + 2) printf("%d %d\n", i, m + 2 - i);
	for (int i = 1; i <= m; ++i) 
		if (2 * i < m + 1) printf("%d %d\n", m + 1 + i, 2 * m + 2 - i);
	return 0;
}


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


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

    if N==1:
        print('1 1')
        return

    C = [False]*8
    r = 0
    for a in A:
        if a<400:
            C[0] = True
        elif a<800:
            C[1] = True
        elif a<1200:
            C[2] = True
        elif a<1600:
            C[3] = True
        elif a<2000:
            C[4] = True
        elif a<2400:
            C[5] = True
        elif a<2800:
            C[6] = True
        elif a<3200:
            C[7] = True
        else:
            r += 1

    c_cnt = C.count(True)
    c_min = max(c_cnt, 1)
    c_max = c_cnt + r
    print(' '.join(map(str, [c_min, c_max])))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！

int main(){
    int w, h, n;
    cin >> w >> h >> n;
    vector<int> x(100), y(100), a(100);
    rep (i, n) cin >> x.at(i) >> y.at(i) >> a.at(i);
    int minx, maxx, miny, maxy;
    minx = 0; miny = 0;
    maxx = w; maxy = h;
    rep (i, n) {
        if(a.at(i) == 1) minx = max(minx, x.at(i)); //ai=1のときは長方形のx<xiをみたす領域
        else if (a.at(i) == 2) maxx = min(maxx, x.at(i)); //ai=2のときは長方形のx>xiをみたす領域
        else if (a.at(i) == 3) miny = max(miny, y.at(i)); //ai=3のときは長方形のy<yiをみたす領域
        else maxy = min(maxy, y.at(i)); //ai=4のときは長方形のy>yiをみたす領域
    }
    int dx, dy;
    dx = max(0, maxx - minx);
    dy = max(0, maxy - miny);
    cout << dx * dy << endl;
    return 0;
}


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

using namespace std;

#define ll long long

int main(){
  ll n,tmp,cnt = 0;
  cin >> n;
  vector<ll> a(1000000+1),tv(n);
  for(int i=0;i<n;i++){
    cin >> tv[i];
  }
  sort(tv.begin(),tv.end());
  for(int i=0;i<n;i++){
    bool mushi = ((i!=0&&tv[i]==tv[i-1])||(i!=n-1&&tv[i]==tv[i+1]));
    if(a[tv[i]]==0){
      if(!mushi){
        cnt++;
      }
      ll kake = 1;
      while(tv[i]*kake<=1000000){
        a[tv[i]*kake] = 1;
        kake++;
      }
    }
    
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 12760
#include<iostream>
using namespace std;
int main()
{
    long long int a,b,c,d,e;
    cin>>a>>b>>c;
    if(a>b)
        d=a-b;
    e=c-d;
    if(e>=0)
        cout<<e;
    else
        cout<<0;
    return 0;
}


Measured memory_bytes: 3624
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 55 , P = 1e9 + 7;
int n , tot , a[N*2];
int f[N*2][N*2] , g[N*2][N*2];
inline void pp(int &x,int d){
  if((x+=d)>=P)x-=P;
}

int main(){
  cin >> n;
  tot = 2 * n - 1;
  rep(i,0,tot) cin >> a[i];
  sort(a , a + tot);
  f[1][1] = 1;
  rep(d,1,n) {
    int m=d*2+1;
    rep(i,0,m+1) rep(j,0,m+1) g[i][j]=0;
    rep(i,0,m+1) rep(j,0,m+1) if(f[i][j]) {
      int ni=i,nj=j;
      int l=n-1-d,r=n-1+d;
      if(a[l]!=a[l+1]) ni++,nj++;
      if(a[r]!=a[r-1]) ni++;
      rep(k,1,nj) pp(g[ni-(nj-k-1)][k] , f[i][j]);
      pp(g[ni][nj] , f[i][j]);
      rep(k,nj+1,ni+1) pp(g[ni-(k-nj-1)][nj+1] , f[i][j]);
    }
    rep(i,0,m+1) rep(j,0,m+1) f[i][j]=g[i][j];
  }
  int ans=0;
  rep(i,0,tot+1) rep(j,0,tot+1) pp(ans,f[i][j]);
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

const li mod = 1e9 + 7;

li pow(li x, li n) {
    if (n == 0) {
        return 1;
    }
    if (n == 1) {
        return x;
    }

    li sq = pow(x, n / 2);
    if (n & 1) {
        return sq * sq % mod * x % mod;
    }
    return sq * sq % mod;
}

li inv(li x) {
    return pow(x, mod - 2);
}

int main() {
    li n;
    cin >> n;
    vector<li> xs(n);
    for (int i = 0; i < n; ++i) {
        cin >> xs[i];
    }

    li nfact = 1;
    for (int i = 1; i <= n; ++i) {
        nfact = (nfact * i) % mod;
    }

    vector<li> acc(n + 1, 0);
    for (int i = 0; i < n; ++i) {
        li cnt = nfact * inv(i + 2) % mod;
        acc[i + 1] = (acc[i] + cnt) % mod;
    }

    li ans = 0;
    for (int i = 0; i < n; ++i) {
        li ld = i;
        li rd = n - 1 - i;
        li coeff = (acc[ld] + acc[rd] + nfact) % mod;
        ans += coeff * xs[i] % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
using ll = long long;
using pint = pair<int, int>; 
using pll  = pair<ll, ll>;
using vint = vector<int>; 
using vll  = vector<ll>;
using vstr = vector<string>;

//　定数, 変数 *********************************************
const ll MOD=1e9+7;
const ll INF=1ll<<60;
int N,M;

// *********************************************************
int main(){

    // 入力スタンダード
    cin >> N;
    map<string, int> s;

    for(int i=0; i<N; i++){
        string si;
        cin >> si;
        s[si]++;
    }

    cin >> M;
    map<string, int> t;
    for(int i=0; i<M; i++){
        string si;
        cin >> si;
        t[si]++;
    }

    int max=0;
    for(auto str=s.begin(); str != s.end(); str++){
        int val = str->second - t[str->first];
        if( val > max){
            max = val;
        }
    }
    

    cout << max << endl;


    return 0;
}

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

typedef long long ll;
typedef double lf;
typedef long double Lf;
typedef pair <int,int> pii;
typedef pair <ll, ll> pll;

#define TRACE(x) cerr << #x << "  " << x << endl
#define FOR(i, a, b) for (int i = (a); i < int(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define _ << " " <<

#define fi first
#define sec second
#define mp make_pair
#define pb push_back

const int MAXN = 110;

int n, m, p[MAXN][MAXN];
char s[MAXN][MAXN];
int dp[MAXN][MAXN][2];

int rek(int a, int b, int t) {
  if (a == n && b == m) {
    if (!t && p[a][b]) return 1;
    return 0;
  }
  if (a > n || b > m) return MAXN * MAXN * MAXN;
  if (dp[a][b][t] != -1) return dp[a][b][t];
  int ret = MAXN * MAXN * MAXN;
  if (p[a][b] && !t) {
    ret = min(ret, rek(a + 1, b, !t) + 1);
    ret = min(ret, rek(a, b + 1, !t) + 1);
  }
  if (!p[a][b] && t) {
    ret = min(ret, rek(a + 1, b, !t));
    ret = min(ret, rek(a, b + 1, !t));
  }
  if (p[a][b] && t || !p[a][b] && !t) {
    ret = min(ret, rek(a + 1, b, t));
    ret = min(ret, rek(a, b + 1, t));
  }
  ret = min(ret, rek(a + 1, b, 1) + 1);
  ret = min(ret, rek(a, b + 1, 1) + 1);
  return dp[a][b][t] = ret;
}

int main() {
  scanf("%d %d",&n,&m);
  REP(i, n) scanf("%s",s[i]);
  FOR(i, 1, n + 1) FOR(j, 1, m + 1) p[i][j] = (s[i-1][j-1] == '#');
  memset(dp, -1, sizeof dp);
  printf("%d\n",rek(1, 1, 0));
  return 0;
}



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

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

int main(){
	int a,b,c,k;
	scanf("%d %d %d %d",&a,&b,&c,&k);
	int ans=0;
	ans += min(a,k);
	k -= min(a,k);
	k -= min(b,k);
	ans -= k;
	printf("%d",ans);
	return 0;
}


Measured memory_bytes: 1736
#define M 100000
T[M+1],t[M/2];
main(i,j,m,a,b,p,q){
	for(i=2;i<=M;i++)
		if(!T[i])
			for(j=i*2;j<=M;j+=i)T[j]=1;
	for(i=2,j=0;i<=M;i++)if(!T[i])t[j++]=i;
	for(;scanf("%d%d%d",&m,&a,&b),m;printf("%d %d\n",p,q)){
		for(;;m--){
			for(i=0;t[i]*t[i]<=m;i++){
				p=t[i],q=m/t[i];
				if(p*q!=m||T[q])continue;
				if(/*p<=q&&*/a*q<=b*p)goto end;
			}
		}
		end:;
	}
exit(0);}

Measured memory_bytes: 1028
import math
N= int(input())
ans = []
if N == 0:
    print(0)
else:
    for i in range(10**9):
        ans.append(str(abs(N%-2)))
        N = math.ceil(N/-2)
        if N == 1:
            break
    ans.append("1")
    ans2 = [ans[-i] for i in range(1, len(ans) + 1)]
    print("".join(ans2))


Measured memory_bytes: 3060
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  int a, b, c;
  readf (" %d %d %d", &a, &b, &c);
  writeln (a == b && b == c ? "Yes" : "No");
}


Measured memory_bytes: 256
from bisect import bisect_right


def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    CUSUM_A = [0] * (N+1)
    CUSUM_B = [0] * (M+1)

    for i, a in enumerate(A):
        CUSUM_A[i+1] = CUSUM_A[i] + a

    for i, b in enumerate(B):
        CUSUM_B[i+1] = CUSUM_B[i] + b


    ans = 0
    for i, a in enumerate(CUSUM_A):
        rest = K - a
        if rest < 0:
            continue

        j = bisect_right(CUSUM_B, rest) - 1
        ans = max(ans, i+j)

    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 47364
import itertools

n_s = input()
keta = len(n_s)
n = int(n_s)
count = 0

def list_753(n):
    l = list(itertools.product((7, 5, 3), repeat=n))
    ans = []
    for x in l:
        numstr = ''
        for i in range(n):
            numstr += str(x[i])
        ans.append(int(numstr))
    return sorted(ans)

def howmany_753(n):
    return ((3 ** n) - (3 * (2 ** n - 2)) - 3)

def judge_753(n):
    s = str(n)
    if s.count('7') * s.count('5') * s.count('3') != 0:
        return True
    else:
        return False

for i in range(3, keta):
    count += howmany_753(i)

numlist = list_753(keta)
for x in numlist:
    if x <= n:
        if judge_753(x) == True:
            count += 1
    else:
        break
print(count)

Measured memory_bytes: 6524
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const ll mod = 1e+9 + 7;

#define chadd(x, y) x = (x + y) % mod

template<typename T>
struct LichaoTree{
    struct Line{
        T a, b;
        Line(T a, T b) : a(a), b(b) {}
        inline T get(T x) const {return a * x + b;}
        inline bool over(const Line &b, const T &x) const{
            return get(x) < b.get(x);
        }
    };

    // 座標集合
    vector<T> xs;
    
    // 直線集合
    // 区間の半分以上で最小値を取る直線の情報を格納
    // これを見れば最小値が分かるというわけではなく、リーフノードまで見る必要がある。
    vector<Line> seg;
    int sz;

    LichaoTree(const vector<T> &x, T INF) : xs(x){
        sz = 1;
        while(sz < xs.size())   sz <<= 1;
        while(xs.size() < sz)   xs.push_back(xs.back() + 1);
        seg.assign(2 * sz - 1, Line(0, INF));
    }

    void update(Line &x, int k, int l, int r){
        int mid = (l + r) >> 1;
        // bool
        auto latte = x.over(seg[k], xs[l]), malta = x.over(seg[k], xs[mid]);
        // malta = true ならば、今見ている区間で最小値を取り得る直線を交換
        if(malta)   swap(seg[k], x);
        
        if(l + 1 >= r)  return;
        // 左半分を更新
        else if(latte != malta) update(x, 2 * k + 1, l, mid);
        // 右半分を更新
        else    update(x, 2 * k + 2, mid, r);
    }

    // 直線 ax+b=0 を直線集合に入れる
    void update(T a, T b){
        Line l(a, b);
        update(l, 0, 0, sz);
    }

    // xs に入っている k 番目の座標に対するクエリ (座標そのものの値ではないことに注意)
    // 区間 [0, sz) から区間 [k, k+1) まで最小値候補を見ていって、その中の最小値を返す
    T query(int k){
        const T x = xs[k];
        k += sz - 1;
        T ret = seg[k].get(x);
        while(k > 0){
            k = (k - 1) >> 1;
            ret = min(ret, seg[k].get(x));
        }
        return ret;
    }

    void debug(){
        for(int i = 0; i < sz; ++i){
            cerr << seg[i].a << " " << seg[i].b << "\n";
        }
    }
};

vector<ll> dp(200005, numeric_limits<ll>::max());

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

    int n;
    ll c;
    cin >> n >> c;
    vector<ll> h(n);
    for(int i = 0; i < n; ++i){
        cin >> h[i];
    }
    LichaoTree<ll> Lichao(h, numeric_limits<ll>::max());

    dp[0] = 0;
    Lichao.update(-2 * h[0], h[0] * h[0]);
    for(int i = 1; i < n; ++i){
        ll x = Lichao.query(i) + h[i] * h[i] + c;
        chmin(dp[i], x);
        Lichao.update(-2 * h[i], x + h[i] * h[i]);
    }
    cout << dp[n-1] << endl;
}

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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/2

#define MAX_N 1000

int n;
int p[44],t[44];
int dp[44][4];

int main(){
	//cin.sync_with_stdio(false);
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		rep(i,n)scanf("%d%d",p+i,t+i);
		rep(i,44)rep(j,4)dp[i][j]=INF;
		dp[0][0]=0;
		int pnt=0,time=0;
		bool ok=true;
		rep(i,n){
			rep(j,4){
				if(dp[i][j]==INF)continue;
				int sp=time+abs(pnt)*(j+1)+p[i]*1;
				if(sp<=t[i]){
					minch(dp[i+1][1],dp[i][j]+abs(pnt)+p[i]);
				}
				if(j<3){
					sp=time+abs(pnt-p[i])*(j+1);
					if(sp<=t[i])minch(dp[i+1][j+1],dp[i][j]+abs(pnt-p[i]));
				}
			}
			//rep(j,4)dbg(dp[i+1][j]);
			pnt=p[i],time=t[i];
			if(dp[i+1][0]==INF&&dp[i+1][1]==INF&&dp[i+1][2]==INF&&dp[i+1][3]==INF){
				cout<<"NG "<<i+1<<endl;
				ok=false;
			}
			if(!ok)break;
		}
		if(ok){
			int res=INF;
			rep(i,4)minch(res,dp[n][i]);
			cout<<"OK "<<res+p[n-1]<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3132
#include<bits/stdc++.h>
#define ll long long
#define rg register
using namespace std;
ll n,A,B;
int main()
{   scanf("%lld",&n);
	if(n==1) puts("Hello World");
	else scanf("%lld%lld",&A,&B),printf("%lld\n",A+B);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	register int x=0;
	register char ch=getchar();
	while(ch<'0'||ch>'9')	ch=getchar();
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x;
}
typedef pair<int,int>P;
#define ll long long
const int M=1e5+5;
const int N=19;
int n,a[N];
map<P,ll>f[N][N];
ll solve(int l,int r,int x,int y){
	if(f[l][r].count(P(x,y)))	return f[l][r][P(x,y)];
	if(l==r-1)	return 0;
	ll res=LLONG_MAX;
	for(int i=l+1;i<r;i++)
		res=min(res,solve(l,i,x,x+y)+solve(i,r,x+y,y)+1LL*a[i]*(x+y));
	return f[l][r][P(x,y)]=res;
}
int main(){
	n=read();
	for(int i=1;i<=n;i++)	a[i]=read();
	printf("%lld\n",solve(1,n,1,1)+a[1]+a[n]);
	return 0;
}



Measured memory_bytes: 16640
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  int n;
  cin>>n; 
  cout << fixed << setprecision(10);
  double ans=n*n*n/27.0;
    cout<<ans<<endl;
  
}



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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  int N;
  string S;
  ll ans = 0;
  cin >> N >> S;
  vector<vector<int> > v(N, vector<int>(3));
  rep(i, 3) {
    v[N-1][i] = 0;
  }
  for (int i = N-2; i >= 0; i--) {
    if (S[i+1] == 'R') {
      v[i][0] = v[i+1][0]+1;
      v[i][1] = v[i+1][1];
      v[i][2] = v[i+1][2];
    }
    if (S[i+1] == 'G') {
      v[i][0] = v[i+1][0];
      v[i][1] = v[i+1][1]+1;
      v[i][2] = v[i+1][2];
    }
    if (S[i+1] == 'B') {
      v[i][0] = v[i+1][0];
      v[i][1] = v[i+1][1];
      v[i][2] = v[i+1][2]+1;
    }
  }
  // rep (i, N) {
  //   rep(j, 3) {
  //     cout << v[i][j] << ' ';
  //   }
  //   cout << endl;
  // }
  rep (i, N-2) {
    if (S[i] == 'R') {
      for (int j = i+1; j < N-1; j++) {
        if (S[j] == 'G') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'B')
              t = 1;
          }
          ans += (ll)v[j][2]-t;;
          // cout << '1' << endl;
        }
        if (S[j] == 'B') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'G')
              t = 1;
          }
          ans += (ll)v[j][1]-t;
          // cout << '2' << endl;
        }
      }
    }
    if (S[i] == 'G') {
      for (int j = i+1; j < N-1; j++) {
        if (S[j] == 'R') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'B')
              t = 1;
          }
          ans += (ll)v[j][2]-t;
          // cout << '3' << endl;
        }
        if (S[j] == 'B') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'R')
              t = 1;
          }
          ans += (ll)v[j][0]-t;
          // cout << '4' << endl;
        }
      }
    }
    if (S[i] == 'B') {
      for (int j = i+1; j < N-1; j++) {
        if (S[j] == 'G') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'R')
              t = 1;
          }
          ans += (ll)v[j][0]-t;
          // cout << '5' << endl;
        }
        if (S[j] == 'R') {
          ll t = 0;
          if (j+j-i <= N-1) {
            if (S[j+j-i] == 'G')
              t = 1;
          }
          ans += (ll)v[j][1]-t;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a,b,c,k;
    cin>>a>>b>>c>>k;

    if (k<=a+b) {
        cout << min(a,k) << endl;
    } else {
        cout << 2*a-k+b << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(x) (x).begin(), (x).end()
typedef long long ll;

int main()
{
    int a;
    string s;
    cin >> a >> s;
    string ans = "red";
    if (a >= 3200)
        ans = s;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>N>>K;
    vec sc(4,0);
    cin>>sc[3]>>sc[0]>>sc[2]>>S;
    set<ll> not_in;
    ll ans = 0;
    rep(i,N){
        bool check = i >= K && not_in.find(i-K) == not_in.end();
        if(check){
            if(S[i] == S[i - K]){
                not_in.insert(i);
            }else{
                ans += sc[S[i] - 'p'];
            }
        }else{
            ans += sc[S[i] - 'p'];
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 2688
N,A,B = map(int,input().split())
S = input()
SS = list(S)
CA = 0
CB = 0
for i in range(len(SS)):
  if SS[i] =='a':
    if CA < A+B:
      CA +=1
      print('Yes')
    else:
      print('No')
  elif SS[i] == 'b':
    CB += 1
    if CA < A+B and CB <= B :
      CA +=1
      print('Yes')
    else:
      print('No')
  else:
    print('No')

Measured memory_bytes: 9932
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n,c=0,item;
    cin>>n;
    for(long long int i=1;i<=n;i++)
    {
        cin>>item;
        if(item%2==0)
        {
            while(item%2==0)
            {
                item/=2;
                c++;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(){
	int n,m,p;
	while(cin>>n>>m>>p){
                if(n==m && m==p && n==0)break;
		int sum=0;
		int suc=0;
		for(int i=1;i<=n;i++){
			int x;
			cin>>x;
			if(i==m)suc=x;
			sum+=x;
		}
		sum*=(100-p);
		if(suc!=0)cout<<sum/suc<<endl;
		else cout<<0<<endl;
	}
}

Measured memory_bytes: 1160
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int m = N/2;
        if (N % 2 == 1) {
            m+=1;
        }
        double ans = (double) m/N;
        System.out.println(String.format("%.10f",ans));
    }
}

Measured memory_bytes: 23764
module Main where

import Data.List
import Data.Char (digitToInt)
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import qualified Data.Map.Strict as M
import qualified Data.Vector.Unboxed as V


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

fastPowerMod :: Int -> Int -> Int -> Int
fastPowerMod b 0 _ = 1
fastPowerMod b 1 modnum = b `mod` modnum
fastPowerMod b n modnum
            | even n = (fastPowerMod b (n `div` 2) modnum ^ 2) `mod` modnum
            | otherwise = (fastPowerMod b (n - 1) modnum * b) `mod` modnum


solve :: [Int] -> Int
solve ns = case findNum of
                1 -> -1
                _ -> break
    where
    inner (findNum, break) num
            | findNum == num = (findNum + 1, break)
            | otherwise = (findNum, break + 1)
    (findNum, break) = foldl' inner (1, 0) ns

main = do
    (a,b ) <- readTuple2
    print $ lcm a b



Measured memory_bytes: 380
package main

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

func main() {
	S := nextString()
	rs := []rune(S)
	var cnt int
	for i := 1; i < len(rs); i++ {
		before := rs[i-1]
		if rs[i] != before {
			rs = append(rs[:i], rs[i+1:]...)
			i--
			rs = append(rs[:i], rs[i+1:]...)
			i--
			cnt += 2

			if i <= 0 {
				i = 0
			}
		}
	}

	fmt.Println(cnt)
}

// Input. ----------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
}

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

	return i
}

func nextFloat() float64 {
	sc.Scan()
	f64, err := strconv.ParseFloat(sc.Text(), 64)
	if err != nil {
		panic(err)
	}

	return f64
}

func nextString() string {
	sc.Scan()
	if err := sc.Err(); err != nil {
		panic(err)
	}

	return sc.Text()
}

// ---------- Input.

// Util. ----------

func abs(x int) int {
	return int(math.Abs(float64(x)))
}

func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

// ---------- Util.


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

int main(){
	int n, q; scanf("%d%d", &n, &q);
	vi v(300001, -1);
	rep(i, n){ int x; scanf("%d", &x); v[x] = x; }
	for(int i = 1; i < v.size(); i++) v[i] = max(v[i], v[i - 1]);
	
	while(q--){
		int x, ans = 0; scanf("%d", &x);
		for(int i = x - 1, m = 0; i < v.size(); i += x, m += x){
			ans = max(ans, v[i] - m);
			if(ans == x - 1) break;
		}
		printf("%d\n", ans);
	}
	return 0;
}


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

int main() {
    ll n , k;
    cin >> n >> k;
    vector <ll> p(n);
    for(ll i = 0; i < n; i++){
        cin >> p[i];
    }
    ll sum = 0;
    for(ll i = 0; i < k; i++){
        sum += p[i];
    }
    ll t = sum;
    for(ll i = k; i < n; i++){
        sum += p[i];
        sum -= p[i - k];
        t = max(t , sum);
    }
    cout << fixed << setprecision(10) << (t + k) / 2.0 << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <cctype>
using namespace std;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-i-1]){
			cout<<"No"<<endl;
			return(0);
		}
	}
	for(int i=0;i<(s.size()-1)/2;i++){
		if(s[i]!=s[(s.size()-1)/2-1-i]){
			cout<<"No"<<endl;
			return(0);
		}
	}
	for(int i=(s.size()+3)/2-1;i<s.size();i++){
		if(s[i]!=s[s.size()-i-1]){
			cout<<"No"<<endl;
			return(0);
		}
	}
	cout<<"Yes"<<endl;
  return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m;

    cout<<n+(m>>1)<<"\n";

    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        var inputs = Console.ReadLine().Split(' ');
        var N = int.Parse(inputs[0]);
        var K = int.Parse(inputs[1]);
        var h = new long[N];
        for (int i = 0; i < N; i++)
        {
            h[i] = long.Parse(Console.ReadLine());
        }

        h = h.OrderBy(hv => hv).ToArray();
        var min = 10000000000;
        for (int i = 0; i < N - K + 1; i++)
        {
            var hmax = h[i + K - 1];
            var hmin = h[i];
            var diff = hmax - hmin;
            min = Math.Min(min, diff);
        }

        Console.WriteLine(min);
    }
}



Measured memory_bytes: 20700
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

L=[2,1]
for _ in range(90):
    L.append(L[-1]+L[-2])
N = int(readline())
print(L[N])

Measured memory_bytes: 3064
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int A = 0;
    int B = 0;
    
    scanf("%d %d",&A,&B);
    
    if (A > 8 || B > 8) {
        printf(":(\n");
    }
    
    if (A <= 8 && B <= 8) {
        printf("Yay!\n");
    }
    
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<ll, ll>pll;
int c1, c2;
int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s, t1, t2;
    cin >> s;
    for(int i = 0;i < s.size();++i)
    {
        if(i % 2)
        {
            t1 += '0';
            t2 += '1';
        }
        else
        {
            t1 += '1';
            t2 += '0';
        }
    }
    for(int i = 0;i < s.size();++i)
    {
        c1 += (t1[i] != s[i]);
        c2 += (t2[i] != s[i]);
    }
    cout << min(c1, c2);
    return 0;
}



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

int main(){

  char x,y;
  string c,z[5] = {"0","0","0","0","0"};
  int a,b;

  z[0] = "A";

  while(scanf(" %c,%c",&x,&y) != EOF){

    if(x == 'A') a = 0;
    if(x == 'B') a = 1;
    if(x == 'C') a = 2;

    if(y == 'A') b = 0;
    if(y == 'B') b = 1;
    if(y == 'C') b = 2;

    swap(z[a],z[b]);
  }

  for(int i=0;i<3;i++){
    if(z[i] == "A"){
      if(i == 0) cout << "A" << endl;
      if(i == 1) cout << "B" << endl;
      if(i == 2) cout << "C" << endl;
    }
  }

}

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

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



Measured memory_bytes: 3120
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <functional>
#define inf 1e9+7
using namespace std;
typedef long long ll;
const int MAXN=5e6+10;
const int MAX=1e3+10;
const double eps=1e-6;

int n;
int mapp[10][110];
int ans[10][110];

int main(){
    #ifdef ONLINE_JUDGE
    #else
    //freopen("in.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif

    cin>>n;
    for(int i=1;i<=2;i++){
        for(int j=1;j<=n;j++){
            scanf("%d",&mapp[i][j]);
        }
    }
    ans[1][1]=mapp[1][1];
    ans[2][n]=mapp[2][n];
    for(int i=2;i<=n;i++)
        ans[1][i]=ans[1][i-1]+mapp[1][i];
    for(int i=n-1;i>=1;i--)
        ans[2][i]=ans[2][i+1]+mapp[2][i];
    int maxx=0;
    for(int i=1;i<=n;i++){
        if(ans[1][i]+ans[2][i]>maxx)
            maxx=ans[1][i]+ans[2][i];
    }
    cout<<maxx<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<bitset>
#include<functional>
#include<climits>
using namespace std;
typedef pair<int,int>pii;
const int INF=1e9;
const int dx[]={0,-1,0,1},dy[]={-1,0,1,0};



int main(){
    int n;
    while(cin>>n,n){
        int fld[101][101]={{0}};
        int w,h;
        cin>>w>>h;
        for(int i=0;i<n;i++){
            int x,y;
            cin>>x>>y;
            fld[y][x]++;
        }
        for(int i=1;i<=100;i++){
            for(int j=1;j<=100;j++){
                fld[i][j]+=fld[i-1][j]+fld[i][j-1]-fld[i-1][j-1];
            }
        }
        int ma=0;
        int s,t;
        cin>>s>>t;
        for(int i=t;i<=h;i++){
            for(int j=s;j<=w;j++){
                ma=max(ma,fld[i][j]-fld[i-t][j]-fld[i][j-s]+fld[i-t][j-s]);
            }
        }
        printf("%d\n",ma);
    }
    return 0;
}

Measured memory_bytes: 1188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
using namespace std;
typedef long long LL;

LL n,ans = 0;
LL a[200005],b[200005];
LL c[200005];

struct node{
	LL id,val;
	bool operator < (const node &nd)const{
		return nd.val > val;
	}
}h,t;
priority_queue <node> q;

bool cmp(LL x,LL y){
	return b[x] > b[y];
}

LL getnum(LL x){
	if(x == 0) return n;
	if(x == n + 1) return 1;
	return x;
}

int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	for(LL i = 1;i <= n;i ++) cin >> a[i];
	for(LL i = 1;i <= n;i ++) cin >> b[i];
	for(LL i = 1;i <= n;i ++){
		if(a[i] < b[i]){
			t.id = i; t.val = b[i];
			q.push(t);
		}
	}
	
	while(!q.empty()){
		LL del,mns,i = q.top().id; q.pop();
		del = b[i] - a[i];
		mns = b[getnum(i - 1)] + b[getnum(i + 1)];
		
		if(del / mns == 0 && b[i] != a[i]){ cout << -1 << endl; return 0; }
		
		ans += del / mns;
		b[i] -= (del / mns) * mns;
		if(b[i] > a[i]){
			t.id = i; t.val = b[i];
			q.push(t);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 9328
import java.util.*;
public class Main {
    public static void main(String[] args) {
      Scanner scan = new Scanner(System.in);
      String name1 = scan.next();
      String name2 = "aiueo";
        if(name2.contains(name1)){
          System.out.println("vowel");
        }
        else {
          System.out.println("consonant");
        }
    }
}

Measured memory_bytes: 21844
# sys.stdin.readline()
import sys
input = sys.stdin.readline

N,K=map(int, input().split())
h=list(map(int, input().split()))
import numpy as np 
      
f_inf = float('inf')
dp = [f_inf]*N
dp[0]=0
# hの配列を作る。
h = np.array(h)
 
#配るDP
for i in range(1,N):
    # start は負になることはない。
    start = max(0, i-K)
    # 行列として足し算できるのでforを使う必要がない。
    dp[i] = min(dp[start: i] + np.abs(h[i] - h[start: i]))
    
print(dp[-1])

Measured memory_bytes: 31968
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    long long n;
    cin >> n;
    for (int i=sqrt(n);i>=1;i--)
    {
        if (n%i==0)
        {
            cout << i+n/i-2;
            break;
        }
    }
}


Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 110;
int n , a[N];

int main(){
  cin >> n;
  rep(i,0,n) cin >> a[i];
  int mn = 1<<30;
  rep(i,-100,101) {
    int cost = 0;
    rep(j,0,n) cost += (a[j] - i) * (a[j] - i);
    mn = min(mn , cost);
  }
  cout << mn << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,a[100050],mi;
bool ans=1;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=n-1;i>=1;i--)
	{
		if(a[i]-a[i+1]>1)ans=0;
		if(a[i]-a[i+1]==1)a[i]--;
	}
	puts(ans?"Yes":"No");
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int cn = 0;
    vector<int> a;
    for(int i=0;i<n;++i){
        int val;
        cin>>val;
        if(val%2==0)
        if(!(val%3==0 || val%5==0)){
            cn++;
        }
    }
    cout<<(cn ? "DENIED" : "APPROVED")<<'\n';
    return 0;
}

Measured memory_bytes: 256