akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
using namespace std;
 
int main() {
    int N, K, Q;
    cin >> N >> K >> Q;
 
    vector<int> points(N, K - Q);
 
    for (int i = 0; i != Q; i++) {
        int answer;
        cin >> answer;
 
        points[answer-1] += 1;
    }
 
    for (int i = 0; i != N; i++) {
        if (points[i] > 0) {
            cout << "Yes"s;
        } else {
            cout << "No"s;
        }
        if (i == N-1)
            break;
        cout << "\n"s;
    }
}

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


int main()
{
	ll n,k;
	cin>>n>>k;
	if(n==k || n==0 || k==1)cout<<0;
	else if(n%k==0)cout<<0;
	else cout<<min(n%k,abs(k-(n%k)));
}

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

int main() {
    int n, k;
    cin >> n >> k;
    int ans = 0;
    rep(i,n) {
        int h;
        cin >> h;
        if (h >= k) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
using namespace std;
void print(int A[],int N)
{
    for(int i=0;i<N;i++)
    {
        if(i>0)
        {
            cout<<" ";
        }
        cout<<A[i];
    }
    cout<<endl;
}
void insertsort(int A[],int N)
{
    int temp,i,j;
    for(i=1;i<N;i++)
    {
        temp=A[i];
        j=i-1;
        while(j>=0&&A[j]>temp)
        {
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=temp;
        print(A,N);
    }
}
int main()
{
    int n,i,j;
    int a[105];
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    print(a,n);
    insertsort(a,n);
    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	ll A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;
	
	ll dist = abs(A-B);
	ll move = T * (V-W);
	
	if(dist <= move){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define LL long long int
#define FAST ios_base::sync_with_stdio(false);
#define INPT cin.tie(NULL);
#define OUTPT cout.tie(NULL);
#define fori(i,a,b) for(i=a;i<b;i++)
#define forireverse(i,a,b) for(i=a;i>=b;i--)
#define full(x) x.begin(),x.end()
#define sortV(x) sort(full(x))
#define sortVgr(x) sort(full(x),greater<LL>()) // x -> vector
#define reverse(x) reverse(full(x)) // x -> string
#define go(t) while(t--)
#define endl cout<<"\n"
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define mp make_pair
#define M 1e9+7

LL gcd(LL a, LL b)
{
	if(a==0) return b;
	else return gcd(b%a,a);
}

int main()
{
	/*#ifndef ONLINE_JUDGE
	freopen("inputAtC.txt","r",stdin);
	freopen("outputAtC.txt","w",stdout);
	#endif*/
	FAST INPT OUTPT
	LL t=1;
	//cin>>t;
	go(t)
	{
		string s;
		cin>>s;
		LL n;
		n=s.length();
		LL i,sum=0;
		char A[n+1];
		strcpy(A,s.c_str());
        fori(i,0,n) sum+=(A[i]-'0');
        if(sum%9==0) cout<<"Yes";
        else cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
const int maxN = 3 * (int)1e5 + 10;
int n;
string s;
int cur = 0;
int ans = 0;
int ri[maxN];
int li[maxN];
int main() {
    //freopen("input.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> n;
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
        if (i != 0) li[i] = li[i - 1];
        if (s[i] == 'W') li[i]++;
    }
    for (int i = n - 1; i >= 0; i--) {
        ri[i] = ri[i + 1];
        if (s[i] == 'E') ri[i]++;
    }
    int ans = n;
    for (int i = 0; i <= n - 1; i++) {
        int pos = i;
        int val = 0;
        if (pos > 0) val += li[pos - 1];
        val += ri[pos + 1];
        ans = min(ans, val);
    }
    cout << ans;
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

const int INF = (1 << 30) - 1;
const ll INF64 = ((ll)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int h, w;
	cin >> h >> w;

	vector<string> a(h);
	for (auto &v : a) {
		cin >> v;
	}

	vector<bool> row(w);
	for (int x = 0; x < w; x++) {
		bool res = true;
		for (int y = 0; y < h; y++) {
			if (a[y][x] == '#') {
				res = false;
				break;
			}
		}

		row[x] = res;
	}

	vector<bool> col(h);
	for (int y = 0; y < h; y++) {
		bool res = true;
		for (int x = 0; x < w; x++) {
			if (a[y][x] == '#') {
				res = false;
				break;
			}
		}

		col[y] = res;
	}

	for (int i = 0; i < h; i++) {
		bool isOut = false;
		for (int j = 0; j < w; j++) {
			if (row[j] || col[i]) {
				continue;
			}
			cout << a[i][j];
			isOut = true;
		}

		if (isOut) {
			cout << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, i;
    long long int sum = 0;
    cin >> n;
    for(i=1; i<=n; i++){
        if(i%3 != 0 && i%5 != 0){
            sum += i;
        }
    }
    cout << sum << '\n';
    return 0;
}




Measured memory_bytes: 3572
N, M, K = map(int, input().split(' '))
A_ls = [0] + list(map(int, input().split(' ')))
for i in range(N):
    A_ls[i + 1] += A_ls[i]
B_ls = [0] + list(map(int, input().split(' ')))
for i in range(M):
    B_ls[i + 1] += B_ls[i]

b_cnt, result = M, 0
for a_cnt in range(N + 1):
    if A_ls[a_cnt] > K:
        break
    while A_ls[a_cnt] + B_ls[b_cnt] > K and b_cnt > 0:
        b_cnt -= 1
    result = max(result, a_cnt + b_cnt)
print(result)

Measured memory_bytes: 45376
#include<iostream>
#include<cstdio>
using namespace std;
const int N=1000005;
int n;
char s[N];
int a[N];
int cnt[3];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;i++)
		a[i]=s[i]-'1';
	bool flag=false;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==1) flag=true;
		cnt[a[i]]+=(((n-1)&(i-1))==(i-1));
	}
	if(cnt[1]&1) printf("1");
	else if(!flag&&(cnt[2]&1)) printf("2");
	else printf("0");
	return 0;
}

Measured memory_bytes: 8584
using System;
using System.Collections.Generic;

namespace kekW
{
    internal static class Program
    {
        private static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            var ab = new List<Tuple<int, int>>();

            for (int i = 0; i < n; i++)
            {
                int[] nbrs = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                ab.Add(new Tuple<int, int>(nbrs[1], nbrs[0]));
            }

            ab.Sort();

            int time = 0;
            int currentDeadline;
            int yesNo = 0;

            for (int i = 0; i < n; i++)
            {
                currentDeadline = ab[i].Item1;

                if (time + ab[i].Item2 > currentDeadline)
                {
                    yesNo = 1;
                    break;
                }
                else
                    yesNo = 2;

                time += ab[i].Item2;
            }

            if (yesNo == 1)
                Console.WriteLine("No");
            else
                Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 27624
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<int> a(n);
    int f = 0, t = 0, e = 0;
    rep(i, 0, n){
        cin >> a[i];
        if(a[i] % 4 == 0) f++;
        else if(a[i] % 2 == 0) t++;
        else e++;
    }
    bool ans = false;
    if(t == 0){
        if(f >= e - 1) ans = true;
    }else{
        if(f >= e) ans = true;
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 1024
num = list(map(int, input().rstrip().split()))
k = num[2]
num.pop(2)
minimum = min(num)
maximum = max(num)

list_yakusuu = []
for i in range(minimum):
    if minimum%(i+1) == 0:
        list_yakusuu.append(i+1)
list_yakusuu.reverse()

count = 0
for j in list_yakusuu:
    if maximum%j == 0:
        count += 1
    
    if count == k:
        print(j)
        break


Measured memory_bytes: 3060
// Bismillahir Rahmanir Rahim  //
// Tanbir Ahmed  << RibNat >>  //
// University of Barisal       //

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define     fast            ios_base::sync_with_stdio(false);cin.tie(NULL)
#define     in1(X)          scanf("%lli",&(X))
#define     ins(S)          scanf("%s",(S))
#define     out(X)          printf("%lli",(X))
#define     outs(S)         printf("%s",(S))
#define     printnl         printf("\n")
#define     End             return 0
#define     ll              long long int
#define     Pair            pair<ll,ll>
#define     F               first
#define     S               second
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     Max             1000000000000000014
#define     Min             -1000000000000000014
#define     mod             1000000007
#define     range           100007

#define     pb              push_back
#define     Vector          vector<ll>
#define     mp              make_pair
#define     PI              3.1415926535897
#define     min_heap        priority_queue <ll, vector<ll>, greater<ll> >
#define     ordered_set     tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>  //*(x.find_by_order(k)),x.order_of_key(k)

/*************** #Template FUNCTIONS# **************/

 ll pc;void PrintCase(){printf("Case %lli: ",++pc);}
// ll GCD(ll a,ll b){if(a<0) a*=-1;if(b<0) b*=-1;if(a<b)swap(a,b);if(b==1) return 1;if(!b) return a;if(!(a%b)) return b;else return GCD(b,a%b);}
//  ll LCM(ll a,ll b){ll x=GCD(a,b);return (a/x)*b;}
// ll bigmod(ll n,ll p){if(p==0) return 1;if(p==1)return (n+mod)%mod;if(p%2)return (bigmod(n,p-1)*n+mod)%mod;else{ll x=bigmod(n,p/2);return (x*x+mod)%mod;}}
// ll power(ll n,ll p){if(p==0) return 1;if(p==1)return n;if(p%2)return power(n,p-1)*n;else{ll x=power(n,p/2);return x*x;}}
// ll modinverse(ll n){return bigmod(n,mod-2)%mod;}
// ll Check(ll n,ll i){return (n&(1LL<<i));}
// ll Set(ll n,ll i){return (n|(1LL<<i));}
// ll status[(ll)range/64+5];Vector primes;void sieve(){for(ll i=3;i<=sqrt(range);i+=2){if(Check(status[i/64],i%64)==0){for(ll j=i*i;j<range;j+=2*i){status[j/64]=Set(status[j/64],j%64);}}}primes.pb(2);for(ll i=3;i<range;i+=2)if(Check(status[i/64],i%64)==0)primes.pb(i);}

// ll dx[] = {-2, -1, 1, 2,  2,  1, -1, -2};
// ll dy[] = { 1,  2, 2, 1, -1, -2, -2, -1};

// ll X[]= {0,0,1,-1,1,1,-1,-1};
// ll Y[]= {1,-1,0,0,1,-1,1,-1};

/********************** START **********************/

int main()
{
    ll n,i,j,k;
    cin>>n;
    ll a[n+2];
    ll s[n+2];
    mem(s,0);
    for(i=1; i<n; i++){
        cin>>a[i];
        s[a[i]]++;
    }

    for(i=1; i<=n; i++){
        cout<<s[i]<<endl;
    }


}



/*******      ALHAMDULILLAH     *********/  
/*******      Happy Coding      *********/


Measured memory_bytes: 6760
N, M = map(int, input().split(" "))

digit = [-1 for i in range(N)]
for i in range(M):
    s, c = map(int, input().split(" "))
    if s > N:
        print(-1)
        exit()
    if digit[s-1] == -1 or digit[s-1] == c:
        digit[s-1] = c
    else:
        print(-1)
        exit()

if N > 1 and digit[0] == -1:
    digit[0] = 1
for i in range(1, N):
    if digit[i] == -1:
        digit[i] = 0
if N == 1 and M == 0:
    digit[0] = 0

ans = 0
coef = 10 ** (N-1)
for i in range(N):
    if digit[i]:
        ans += digit[i] * coef
    coef //= 10

if ans < 100 and N == 3:
    ans = -1
if ans < 10 and N == 2:
    ans = -1

print(ans)

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

using namespace std;

char A[110][110];
int dp[110][110];
int main()
{
    int n , m ; cin >> n >> m ;
    for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) cin >> A[i][j];
    for(int i = 2 ; i <= max(n,m) ; ++i) dp[i][0] = dp[0][i] = 1e9;
    for(int i = 1 ; i <= n ; ++i){
        for(int j = 1 ; j <= m ; ++j){
            if(A[i][j]=='.') dp[i][j] = min(dp[i-1][j],dp[i][j-1]);
            else dp[i][j] = min(dp[i-1][j] + (A[i-1][j]!='#'),dp[i][j-1] + (A[i][j-1]!='#'));
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;


int main(void){
  ll n, x, y;
  cin >> n >> x >> y;
  x--; y--;
  map<ll, ll> mp;
  REP(i, n) FOR(j, i+1, n){
    ll d = min(abs(j-i), min(abs(x-i)+abs(j-y)+1, abs(y-i)+abs(j-x)+1));
    mp[d]++;
  }
  FOR(i, 1, n) cout << mp[i] << endl;
  return 0;
}

Measured memory_bytes: 384
n, m = gets.to_i
c = gets.split.map &:to_i

dp = [Float::INFINITY] * (n+1)

dp[0] = 0

c.each {|x|
  (0..n-x).each {|i|
    dp[i + x] = [dp[i + x], dp[i] + 1].min
  }
}

p dp[n]



Measured memory_bytes: 9296
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long c = sc.nextLong();
        long k = sc.nextLong();

        long ans;
        if (a >= k) {
            ans = k;
            System.out.println(ans);
        } else if (a + b >= k) {
            ans = k - (k - a);
            System.out.println(ans);
        } else {
            ans = a + -1 * (k - a - b);
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 35600
#include<bits/stdc++.h>
#define LL long long
#define PB push_back
#define POP pop_back()
#define PII pair<int,int>
#define ULL unsigned long long
using namespace std;
const int INF=0x3f3f3f3f;
const double pi=acos(-1),eps=1e-10;
const int maxn=1<<17;
const int N=1e2+10,M=1e5+100;
const int mod=1e9+7;
int dp[N][M], sum[N][M], n , k, a[N];
int main()
{
    ios::sync_with_stdio(false),cin.tie(0);
    cin >> n >> k;
    for(int i = 1; i <= n; i++){
        cin >> a[i];
    }
    dp[0][k] = sum[0][k] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= k; j++){
            dp[i][j] = (sum[i-1][min(k, j+a[i])] - sum[i-1][j-1] + mod) % mod;
        }
        sum[i][0] = dp[i][0] = sum[i-1][a[i]];
        for(int j = 1; j<= k; j++){
            sum[i][j] = (sum[i][j-1] + dp[i][j])% mod;
        }
    }
    cout << dp[n][0] <<endl;
    
}
/*
1
6 7
0 0 0 0 0 0
0 1 0 3 0 1
2 9 1 2 1 2
8 7 1 3 4 3
1 0 2 2 7 7
0 1 0 0 1 0
0 0 0 0 0 0
*/

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

int gcd(int x, int y)
{
    return (x % y) ? gcd(y, x % y) : y;
}

int main()
{
    string S, T;
    cin >> S;
    cin >> T;

    int ans = T.size();
    for (int i = 0; i <= S.size() - T.size(); i++)
    {
        int diff = 0;
        for (int j = 0; j < T.size(); j++)
        {
            if(S.at(i + j) != T.at(j)){
                diff++;
            }
        }
        ans = min(ans, diff);
    }

    cout << ans << endl;

    return 0;
}

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

int M[15][15];
int temp[15][15];
int n, m;

bool in(int x, int y) {
  return 0<=x && x<n && 0<=y && y<n;
}

void dfs(int y, int x, int bit) {
  const int dx[] = {-1,1,0,0};
  const int dy[] = {0,0,-1,1};
  M[y][x] = 1-M[y][x];
  for(int i=0; i<4; i++) {
    int nx = x+dx[i], ny = y+dy[i];
    if(in(nx, ny) && M[ny][nx] == bit)
      dfs(ny, nx, bit);
  }
}

void island_rev(int r, int c) {
  r--, c--;
  dfs(r, c, M[r][c]);
}

void leftshift(int r) {
  r--;
  int tmp = M[r][0];
  for(int i=0; i<n-1; i++) {
    M[r][i] = M[r][i+1];
  }
  M[r][n-1] = tmp;
}

void rightshift(int r) {
  r--;
  int tmp = M[r][n-1];
  for(int i=n-1; i>=1; i--) {
    M[r][i] = M[r][i-1];
  }
  M[r][0] = tmp;
}

void reversal(int r, int c, int sz) {
  r--, c--;
  for(int i=0; i<sz; i++) {
    for(int j=0; j<sz; j++) {
      M[r+i][c+j] = 1-M[r+i][c+j];
    }
  }
}

void rotate90(int r, int c, int sz) {
  r--, c--;
  for(int i=0; i<sz; i++) {
    for(int j=0; j<sz; j++) {
      temp[i][j] = M[r+i][c+j];
    }
  }

  for(int i=0; i<sz; i++) {
    for(int j=0; j<sz; j++) {
      M[r+i][c+j] = temp[sz-1-j][i];
    }
  }
}

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

  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      cin >> M[i][j];
    }
  }
  
  int op, r, c, sz, ang;
  
  while(m--) {
    cin >> op;
    if(op == 0) {
      cin >> r >> c >> sz >> ang;
      for(int i=0; i<ang; i+=90)
	rotate90(r,c,sz);
    }
    if(op == 1) {
      cin >> r >> c >> sz;
      reversal(r, c, sz);
    }
    if(op == 2) {
      cin >> r;
      leftshift(r);
    }
    if(op == 3) {
      cin >> r;
      rightshift(r);
    }
    if(op == 4) {
      cin >> r >> c;
      island_rev(r, c);
    }
  }
  
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) {
      if(j) cout << " " << M[i][j];
      else cout << M[i][j];
    }
    cout << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1180
n,m=map(int,input().split())
a=[input().split() for i in range(m)]
b=[0]*n
c=[0]*n
for j in range(m):
    if a[j][1]=="AC":
        b[int(a[j][0])-1]=1
    else:
        if b[int(a[j][0])-1]==0:
            c[int(a[j][0])-1]+=1

for k in range(n):
    if b[k]!=1:
        c[k]-=c[k]
print(str(sum(b)),str(sum(c)))


Measured memory_bytes: 33692
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

const int NIL = -1;
const int MAX = 2147483647;
const int NUM = 1000001;
clock_t START, END;
bool debug = false;

ll minv[NUM << 2];
ll p, v, ql, qr;

ll query(ll o, ll L, ll R)
{
	ll M = L + (R - L) / 2, _min = MAX;
	if (ql <= L && R <= qr)
		return minv[o];
	if (ql <= M)
		_min = min(_min, query(o * 2, L, M));
	if (qr > M)
		_min = min(_min, query(o * 2 + 1, M + 1, R));
	return _min;
}

void update(ll o, ll L, ll R)
{
	ll M = L + (R - L) / 2;
	if (L == R) {
		minv[o] = v;
	}
	else {
		if (p <= M)
			update(o * 2, L, M);
		else
			update(o * 2 + 1, M + 1, R);
		minv[o] = min(minv[o * 2], minv[o * 2 + 1]);
	}
}

int main(void)
{
	if (debug) {
		START = clock();
		freopen("in20.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int N, L;
	scanf("%d%d", &N, &L);
	for (int i = 1; i <= N; i++) {
		scanf("%lld", &v);
		p = i;
		update(1, 1, N);
	}
	ql = 1, qr = L;
	while (qr <= N) {
		if (ql != 1)
			printf(" ");
		printf("%lld", query(1, 1, N));
		ql++;
		qr++;
	}
	printf("\n");
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 19600
#include <iostream>
#include <stdio.h>
#include <math.h>
#include <iomanip>

using namespace std;

int main()
{

    double W, H, x, y, ans;
    cin>>W>>H>>x>>y;

    ans = ((W*H)/2);
    if(x == W/2 && y == H/2)
    {
        cout<<fixed<<setprecision(9)<<ans<<" "<<"1";

    }
    else
    {
        cout<<fixed<<setprecision(9)<<ans<<" "<<"0";
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define lld long double
#define MOD 1000000007
#define CAP 100000001
#define inf 1000000000000000000LL
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define endl '\n'
#define sz(v) v.size()
#define all(v)    v.begin(),v.end()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
ll power(ll x,ll y, ll md=MOD){ll res = 1;x%=md;while(y>0){if(y&1)res = (res*x)%md;x = (x*x)%md;y = y>>1;}return res%md;}
#define dbg(x) cout <<#x<<":"<<x<<endl;
ll max1(ll a, ll b, ll c=-inf, ll d=-inf) {ll mx1=(a>b)?a:b, mx2=(c>d)?c:d; return ((mx1>mx2)?mx1:mx2);}
#define int ll


signed main() {
	fast;
	
	ll n;
	cin>>n;
	std::vector<ll> neg,pos;
	std::vector<pii > ans;
	ll s=0;
	
	for(int i=0;i<n;i++){
		ll temp;
		cin>>temp;
		if(temp<0) neg.pb(temp);
		if(temp>=0) pos.pb(temp);
	}

	sort(all(neg));
	sort(all(pos), greater<ll>());

	if(neg.size()==n){
		pos.pb(neg.back());
		neg.pop_back();
	}

	if(pos.size()==n){
		neg.pb(pos.back());
		pos.pop_back();
	}

	for(int i=1;i<pos.size();i++){
		ans.pb(mp(neg[0],pos[i]));
		neg[0]-=pos[i];
	}

	for(int i=0;i<neg.size();i++){
		ans.pb(mp(pos[0],neg[i]));
		pos[0]-=neg[i];
	}
	assert(ans.size()==n-1);
	cout<<pos[0]<<endl;
	for(int i=0;i<ans.size();i++) cout<<ans[i].f<<" "<<ans[i].s<<endl;
} 

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

int main() {
  string S1;
  string S2;
  string S3;
  string S4;

  cin >> S1 >> S2 >> S3;

  cout << S1.at(0) << S2.at(0) << S3.at(0) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mem(a) memset(a,0,sizeof(a))
#define ll long long
int main()
{
	int a;
	cin>>a;
	if(a/100==7||a/10%10==7||a%10==7)cout<<"Yes";
	else cout<<"No"; 
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fori(n) for ( int i = 0; i < (n);i++)
#define forj(n) for ( int j = 0; j < (n);j++)
#define fork(n) for ( int k = 0; k < (n);k++)
#define forghj(n) for ( int ghj = 0; ghj < (n);ghj++)
#define fori1(n) for ( int i = (n)-1; i >= 0;i--)
#define all(vector) (vector).begin(),(vector).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
/*
                            |~~~~~~~|
                            |       |
                            |       |
                            |       |
                            |       |
                            |       |
 |~.\\\_\~~~~~~~~~~~~~~xx~~~         ~~~~~~~~~~~~~~~~~~~~~/_//;~|
 |  \  o \_         ,XXXXX),                         _..-~ o /  |
 |    ~~\  ~-.     XXXXX`)))),                 _.--~~   .-~~~   |
  ~~~~~~~`\   ~\~~~XXX' _/ ';))     |~~~~~~..-~     _.-~ ~~~~~~~
           `\   ~~--`_\~\, ;;;\)__.---.~~~      _.-~
             ~-.       `:;;/;; \          _..-~~
                ~-._      `''        /-~-~
                    `\              /  /
                      |         ,   | |
                       |  '        /  |
                        \/;          |
                         ;;          |
                         `;   .       |
                         |~~~-----.....|
                        | \             \
                       | /\~~--...__    |
                       (|  `\       __-\|
                       ||    \_   /~    |
                       |)     \~-'      |
                        |      | \      '
                        |      |  \    :
                         \     |  |    |
                          |    )  (    )
                           \  /;  /\  |
                           |    |/   |
                           |    |   |
                            \  .'  ||
                            |  |  | |
                            (  | |  |
                            |   \ \ |
                            || o `.)|
                            |`\\\\) |
                            |       |
                            |       |
                            |       |
*/
vector < int > a,k1,k2;
int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    a.resize(n);
    k1.resize(n);
    k2.resize(n);
    fori(n) {
        char c;
        cin >> c;
        if (c == 'W') a[i] = 1; // <
        else a[i] = 0; // >
    }
    if (a[0] == 1) k1[0]++;
    else k2[0]++;
    for ( int i = 1; i < n;i++) {
        k1[i] = k1[i-1];
        k2[i] = k2[i-1];
        if (a[i] == 1) k1[i]++;
        else k2[i]++;
    }
    int minn = k2[n-1]-k2[0];
    for(int j = 1; j < n;j++) {
        minn = min(minn,k1[j-1]+(k2[n-1]-k2[j]));
    }
    cout << minn;
}
/*
6
10 10
10 11
10 12
50 50
50 50
50 51
*/
















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

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

static ll const def=1LL<<60;
template<class V,int NV> class SegTree_3 {
public:
	vector<V> val, ma;
	SegTree_3(){
		int i;
		val.resize(NV*2,0); ma.resize(NV*2,0);
		FOR(i,NV) val[i+NV]=ma[i+NV]=0;
		for(i=NV-1;i>=1;i--) ma[i]=min(ma[2*i],ma[2*i+1]);
	};
	
	V getval(int x,int y,int l=0,int r=NV,int k=1) {
		if(r<=x || y<=l) return def;
		if(x<=l && r<=y) return ma[k];
		return val[k]+min(getval(x,y,l,(l+r)/2,k*2),getval(x,y,(l+r)/2,r,k*2+1));
	}
	
	void update(int x,int y, V v,int l=0,int r=NV,int k=1) {
		if(l>=r) return;
		if(x<=l && r<=y) {
			val[k]+=v;
			ma[k]+=v;
		}
		else if(l < y && x < r) {
			update(x,y,v,l,(l+r)/2,k*2);
			update(x,y,v,(l+r)/2,r,k*2+1);
			ma[k]=val[k]+min(ma[k*2],ma[k*2+1]);
		}
	}
};

int N,Q,A,B;
SegTree_3<ll,1<<20> stl,str;


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>Q>>A>>B;
	for(i=1;i<=N;i++) {
		if(i!=B) {
			stl.update(i,i+1,(1LL<<50)+i);
			str.update(i,i+1,(1LL<<50)-i);
		}
		else {
			stl.update(i,i+1,i);
			str.update(i,i+1,-i);
		}
	}
	ll pre=A;
	while(Q--) {
		ll X;
		cin>>X;
		
		// move other
		ll mi=min(stl.getval(X,N+1)-X,str.getval(1,X+1)+X);
		// move pre
		stl.update(1,N+1,abs(X-pre));
		str.update(1,N+1,abs(X-pre));
		
		// move other
		ll x=stl.getval(pre,pre+1)-pre;
		if(mi<x) stl.update(pre,pre+1,mi-x);
		x=str.getval(pre,pre+1)+pre;
		if(mi<x) str.update(pre,pre+1,mi-x);
		
		pre=X;
	}
	
	ll ret=1LL<<60;
	for(i=1;i<=N;i++) ret=min(ret,stl.getval(i,i+1)-i);
	for(i=1;i<=N;i++) ret=min(ret,str.getval(i,i+1)+i);
	cout<<ret<<endl;
	
}


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


Measured memory_bytes: 65792
n = int(input())
a = list(map(int, input().split()))
pa = []
cnt = 0
for s in a:
    if s < 0:
        cnt += 1
    pa.append(abs(s))
if cnt % 2:
    print(sum(pa) - 2 * min(pa))
else:
    print(sum(pa))
    

Measured memory_bytes: 14332
#include <stdio.h>
#include <stdlib.h>
#define MAX 10000
#define NIL -1

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

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

void setDepth(int, int);
int setHeight(int);
int getSibling(int);
void print(int);

int main(){
  int v, l, r, root = 0;
  int i;
  
  scanf("%d",&n);
  if(n < 1 || n > 25)
    exit(1);
  
  for(i = 0; i < n; i++)
    T[i].parent = NIL;
  
  for(i = 0; i < n; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left = l;
    T[v].right = r;
    if(l != NIL)
      T[l].parent = v;
    if(r != NIL)
      T[r].parent = v;
  }

  for(i = 0; i < n; i++){
    if(T[i].parent == NIL)
      root = i;
  }

  setDepth(root,0);
  setHeight(root);

  for(i = 0; i < n; i++)
    print(i);

  return 0;
}

void setDepth(int u, int d){
  if(u == NIL)
    return;
  D[u] = d;
  setDepth(T[u].left, d+1);
  setDepth(T[u].right, d+1);
}

int setHeight(int u){
  int h1 = 0;
  int h2 = 0;
  if(T[u].left != NIL)
    h1 = setHeight(T[u].left) + 1;
  if(T[u].right != NIL)
    h2 = setHeight(T[u].right) + 1;

  if(h1 > h2)
    H[u] = h1;
  else
    H[u] = h2;
  
  return H[u];
}

int getSibling(int u){
  if(T[u].parent == NIL)
    return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)
    return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)
    return T[T[u].parent].right;
  return NIL;
}

void print(int u){
  int deg = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  
  if(T[u].left != NIL)
    deg++;
  if(T[u].right != NIL)
    deg++;

  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == NIL)
    printf("root\n");
  else if(T[u].left == NIL && T[u].right == NIL)
    printf("leaf\n");
  else
    printf("internal node\n");
}



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

int main() {
  
  int a,b;
  
  cin >> a;
  cin >> b;
  
  string res;
  
  
  string res_a;
  string res_b;
  
  
  for(int i = 0;i< b;i++){
    res_a += to_string(a); 
  //  cout << res_a << endl;
  }

  for(int i = 0;i< a;i++){
    res_b += to_string(b); 
  }

  if(a > b){
    res = res_b;
  }
  else if( a == b){
    if( res_a.size() > res_b.size()){
      res = res_b;
    }
    else{
      res = res_a;
    }
  }
  else{
    res = res_a;
  }
  
  
  cout << res << endl;
}





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

int A, B;

int main()
{
    cin >> A >> B;
    if (B == 1) printf("0\n");
    else {
        int res = (B - 2) / (A - 1) + 1;
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef set<int> si;
typedef set<ll> sl;
typedef pair<int,int> pii;
#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 F first
#define S second

const ll MOD = 1e9+7;
const int MAX = 200050;
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; 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;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll n, m, k;

int main(void) {
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//freopen("in.txt", "r", stdin);
	COMinit();
	cin >> n >> m >> k;
	ll ret = 0;
	rep(d,1,n) {
		ll loc = (n-d) * COM(n*m-2,k-2) % MOD;
		loc = loc * d % MOD;
		loc = loc * m * m % MOD;
		ret = (ret + loc) % MOD;
	}
	rep(d,1,m) {
		ll loc = (m-d) * COM(n*m-2,k-2) % MOD;
		loc = loc * d % MOD;
		loc = loc * n * n % MOD;
		ret = (ret + loc) % MOD;
	}
	cout << ret << '\n';
	return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct AB{
	ll a, s;
}d[10005];
ll n, m;
ll f[330000], vis[330000];
int main(){
	cin>>n>>m;
	for(ll i=1;i<=m;i++){
		ll k;
		scanf("%lld%lld", &d[i].a, &k);
		for(ll j=1;j<=k;j++) {
			ll x;
			scanf("%lld", &x);
			d[i].s|=(1LL<<x);
		}
	}
	memset(f, 0x7f, sizeof(f));
	queue<ll> q;
	q.push(0);
	f[0]=0;
	while(!q.empty()){
		ll u=q.front(); q.pop();
		for(ll i=1;i<=m;i++){
			if(f[u]+d[i].a<f[u|d[i].s]){
				f[u|d[i].s]=f[u]+d[i].a;
				if(!vis[u|d[i].s]){
					vis[u|d[i].s]=1;
					q.push(u|d[i].s);
				}
			}
		}
		vis[u]=0;
	}
	ll s=0;
	for(ll i=1;i<=n;i++) s|=(1LL<<i);
	if(f[s]>1e12) cout<<-1;
	else cout<<f[s];
}


Measured memory_bytes: 3456
#include <stdio.h>
#include <string.h>
int main()
{
	char s[101];
	int c=0,l,i,f;
	while(scanf("%s",s)!=EOF)
	{
		f=1;
		l=strlen(s);
		for(i=0;i<l/2;i++)
			if(s[i]!=s[l-i-1])f=0;
		if(f)c++;
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 0
import java.util.LinkedHashSet;
import java.util.Scanner;
import java.util.Set;

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

			int n = sc.nextInt();
			
			
			Set<String> uniq = new LinkedHashSet<>();
			
			for(int i = 0 ; i < n ; i++ ) {
				uniq.add(sc.next());
			}

			System.out.println(uniq.size());
		}
	}

}

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

using namespace std;
typedef long long ll;

int main(void) {
    int n, k, id;
    ll tmp;
    cin >> n >> k;
    for(int i=1; i<=n; i++) {
        scanf("%lld", &tmp);
        if(tmp == 1) id = i;
    }

    ll ans = INT64_MAX;
    for(int i=0; i<k; i++) {
        tmp = 1;
        if((n-(id+k-1)+i) > 0) {
            if((n-(id+k-1)+i)%(k-1)) tmp++;
            tmp += (n-(id+k-1)+i) / (k-1);
        }
        if((id-i-1) > 0) {
            if((id-i-1)%(k-1)) tmp++;
            tmp += (id-i-1) / (k-1);
        }
        ans = min(ans, tmp);
    }

    return !printf("%lld\n", ans);
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1000;
const int MAXM=200000;
vector<int>G[MAXN+5]; 
int to[MAXM + 5];
void addedge(int u, int i) {G[u].push_back(i);}
int tag[MAXN + 5], que[2*MAXN + 5];
bool ans1[MAXM + 5], ans2[MAXM + 5];
int n, m;
int main() {
	scanf("%d%d", &n, &m);
	for(int i=1;i<=m;i++) {
		int a; scanf("%d%d", &a, &to[i]);
		addedge(a, i);
	}
	for(int i=1;i<=n;i++) {
		for(int j=1;j<=n;j++) tag[j] = 0;
		int s = 1, t = 0;
		for(int p=0;p<G[i].size();p++)
			tag[que[++t] = to[G[i][p]]] = G[i][p];
		while( s <= t ) {
			int x = que[s++], y = tag[x];
			for(int p=0;p<G[x].size();p++) {
				int q = to[G[x][p]];
				if( q != i ) {
					if( tag[q] != -1 ) {
						if( tag[q] == 0 )
							tag[que[++t] = q] = y;
						else if( tag[q] != y )
							tag[que[++t] = q] = -1;
					}
				}
				else ans1[G[x][p]] = 1;
			}
		}
		for(int p=0;p<G[i].size();p++)
			if( tag[to[G[i][p]]] == -1 ) ans2[G[i][p]] = 1;
	}
	for(int i=1;i<=m;i++)
		puts(ans1[i] ^ ans2[i] ? "diff" : "same");
}

Measured memory_bytes: 6536
import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
from bisect import insort
import heapq
sys.setrecursionlimit(10**9)

def main():
    N, M = map(int,input().split())
    A = list(map(lambda x: int(x)*(-1),input().split()))

    heapq.heapify(A)
    for _ in range(M):
        min = heapq.heappop(A) # -1かけてるので本質的にはmax
        half = min * (-1) // 2
        half *= -1
        heapq.heappush(A,half)
        # print(A)
        # print(min)

    # print(A)
    print(sum(A) * -1)


if __name__ == "__main__":
  main()

Measured memory_bytes: 25024
#import string,itertools,fractions,heapq,re,array,bisect
#from math import *
#from collections import Counter
def rl(s): return xrange(len(s))

INF = 2147483647


import sys
stdin = sys.stdin

H, W = map(int, stdin.readline().strip().split())

lines = [stdin.readline() + '.' for _ in range(H)] + ['.' * W]

fail = False
for y, line in enumerate(lines):
    for x, ch in enumerate(line):
        if ch != '#': continue
        if x == W-1 and y == H-1: continue

        right = (line[x+1] == '#')
        down = (lines[y+1][x] == '#')
        if not (right ^ down):
            fail = True

        if not (x == 0 and y == 0):
            if x == 0:
                if lines[y-1][x] != '#': fail = True
            elif y == 0:
                if line[x-1] != '#': fail = True
            else:
                if not ( (lines[y-1][x] == '#') ^ (line[x-1] == '#') ):
                    fail = True

print ('Impossible' if fail else 'Possible')


Measured memory_bytes: 2696
# -*- coding: utf-8 -*-
N = int(input())
A = list(map(int, input().split()))
p = 10**9 + 7

total = 0
for i in range(N):
  total += A[i]
  total = total % p

total_tmp = 0
ans = 0
for i in range(N):
  total_tmp += A[i]
  total_tmp = total_tmp % p
  
  ans += A[i] * (total-total_tmp)
  ans = ans % p
print(ans)

Measured memory_bytes: 93960
def main():
    N = int(input())
    H = list(map(int, input().split()))
    dp = [float('inf')] * (N + 5)
    dp[0] = 0
    for i in range(1,N):
        dp[i] = min(dp[i], dp[i-1] + abs(H[i] - H[i-1]))
        if i - 2 >= 0:
            dp[i] = min(dp[i], dp[i-2] + abs(H[i] - H[i-2]))

    print(dp[N-1])

if __name__ == "__main__":
    main()

Measured memory_bytes: 86104
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	n := nextInt()
	a := make([]int, 3*n)
	for i := range a {
		a[i] = nextInt()
	}

	sort.Ints(a)
	ans := 0
	for i := 1; i < n+1; i++ {
		ans += a[len(a)-2*i]
	}
	fmt.Println(ans)
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


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

using namespace std;

typedef pair<int, int> P;
#define int long long
#define ll long long
#define mod 1000000007
#define INF (1LL<<60)



signed main(){

	int N, K;
	cin >> N >> K;
	int bit[42] = { 0 };
	int A[123456];
	for (int i = 0; i < N; i++) cin >> A[i];

	for (int b = 0; b < 42; b++){
		for (int i = 0; i < N; i++)
			if (A[i] & (1LL << b)) bit[b]++;
	}

	int ans = -INF;
	// greedyにとるのは間違い
	// 1を立てるべきでも、hanten_bitでは0にして、以降はgreedyにするという場合
	for (int hanten_bit = 41; hanten_bit >= 0; hanten_bit--){
		int X = 0;
		for (int b = 41; b >= 0; b--){
			if (bit[b] < N / 2.0){
				// 1を立てるべきでもしない
				if (b == hanten_bit) continue;
				else{
					// Xのbit目は1にすべき
					if ((X | (1LL << b)) <= K){
						X = X | (1LL << b);
					}
				}
			}
		}

		int tmp = 0;
		for (int i = 0; i < N; i++){
			tmp += X^A[i];
		}
		ans = max(ans, tmp);
	}

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

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

int main() {
  	vector<string> s(3);
  	for (int i=0;i<3;i++){
      	cin>>s.at(i);
    }
  	cout<<s.at(0).at(0)<<s.at(1).at(1)<<s.at(2).at(2);
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> p(N);
  for (int i = 0; i < N; ++i) cin >> p[i];
  
  vector<double> q(N);
  for (int i = 0; i < N; ++i) q[i] = (1 + p[i]) / 2.0;
  
  double sum = 0;
  for (int i = 0; i < K; ++i) sum += q[i];
  double ans = sum;
  for (int i = 1; i + K - 1 < N; ++i) {
    sum -= q[i - 1];
    sum += q[i + K - 1];
    ans = max(ans, sum);
  }
  
  cout << fixed << setprecision(20) << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  if (s * t >= d) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3568
#include<bits/stdc++.h>
using namespace std;
#define MAX 10000000
int arr[MAX];
int ans[MAX];

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

    int n;
    cin>>n;
  //  int arr[n];

    for(int i=1;i<=n-1;i++)
    {
        cin>>arr[i];
    }
    for(int i=1;i<=n-1;i++)
    {
        //if(arr[i]==)
        ans[arr[i]]++;
    }
     for(int i=1;i<=n;i++)
    {
        cout<<ans[i]<<endl;
    }

    return 0;
}


Measured memory_bytes: 5096
// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

string S;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> S;
    int N = S.size();

    int ans = 0;
    for (int i = 0; i < N/2; ++i) {
        if (S[i] != S[N-1-i]) ++ans;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int temp;
    int height[10];
    int n = sizeof(height)/sizeof(height[0]);
    for(int x = 0; x < n; x++){
        cin >> height[x];//input
    }
    for(int q = 0; q < n - 1; q++){
        for(int w = 0; w < n - q - 1; w++)
        {
            if(height[w] < height [w+1])
            {
                temp  = height[w];
                height[w] = height[w+1];
                height[w+1] = temp;
            }
        }
    }
    for(int x = 0; x < 3; x++){
        cout << height[x] << endl;
    }
    return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            var a = ReadArrayInt();
            var b = new bool[N + 1];
            for (int i = N; i >= 1; i--)
            {
                var cnt = 0;
                var chk = 2 * i;
                while (chk <= N)
                {
                    if (b[chk]) cnt++;
                    chk += i;
                }
                if (cnt % 2 == 0)
                {
                    if (a[i - 1] == 1) b[i] = true;
                }
                else
                {
                    if (a[i - 1] == 0) b[i] = true;
                }
            }
            var M = b.Count(bl => bl == true);
            if (M == 0) Console.WriteLine(0);
            else
            {
                Console.WriteLine(M);
                for (int i = 0; i <= N; i++) if (b[i]) Console.Write(i + " ");
            }

            Console.WriteLine();
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 26452
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;


int main(){
    long N, K;
    cin >> N >> K;
    vector<pair<int, int> > A(N);
    for(int i=0;i<N;i++){
        int a, b;
        cin >> a >> b;
        A[i] = make_pair(a, b);
    }
    sort(A.begin(), A.end());
    //for(int i=0;i<N;i++) cout << A[i].first << " "<< A[i].second << endl;
    long cnt=0;
    int i;
    for(i=0;i<N;i++){
        cnt += A[i].second;
        if(K<=cnt) break; 
    }
    cout << A[i].first << endl;
}

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


int main() {
	
	int a,b;
	cin >> a >> b;
	string c,d;
	for(int i=0; i<b; i++) c += to_string(a);
	for(int i=0; i<a; i++) d += to_string(b);
	
	cout << (c < d ? c : d) << endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
//constexpr ll MOD = 998244353;
//constexpr ll MOD = ;
ll mod(ll A, ll M) {return (A % M + M) % M;}
constexpr ll INF = 1LL << 60;
template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
ll divceil(ll A, ll B) {return (A + (B - 1)) / B;}
#define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false)

int main()
{
  ll N, M;
  cin >> N >> M;
  cout << ((N == M) ? "Yes" : "No") << endl;
}

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

int main(){
	int h, w;
	cin >> h >> w;
	string a[h];
	for(int i = 0; i < h; i++) cin >> a[i];
	int b = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			b += (a[i][j] == '#');
		}
	}
	cout << ((b == (h+w-1)) ? "Possible" : "Impossible") << endl;
}


Measured memory_bytes: 256
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n; cin >> n;
  vector<ll> h(n); cin >> h;
  ll ans = 0;
  rep(i, n) ans += h[i];
  rep(i, n-1) ans -= min(h[i], h[i+1]);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;


int main(){
    int N, M, A, B, C;
    string s1, s2;
    cin >> N;
    vector<ll> a(N), x(N);
    rep(i, N) cin >> a[i];
    x = a;
    sort(all(a));
    int i1 = N / 2 - 1;
    int i2 = N / 2;
    rep(i, N){
        if(x[i] <= a[i1]){
            cout << a[i2] << endl;
        }else{
            cout << a[i1] << endl;
        }
    }
    

  }

Measured memory_bytes: 6324
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000000;
const long long MOD = 1000000007;

bool f(long long N){
  string s = to_string(N);
  long long slen = s.length();
  slen--;
  for (int i = 0; i < s.length(); i++)
  {
    if(s[i]!=s[slen-i])
      return false;
  }
  return true;
}

int main()
{
  long long A, B, K;
  cin >> A >> B >> K;
  set<long long> set;
  for (int k = 0; k < K; k++)
  {
    if(set.find(A+k)!=set.end())
      continue;
    if(A+k>B)
      continue;
    set.insert(A + k);
    cout << A + k << endl;
  }

  for (int k = K-1; k>=0; k--){
    if (set.find(B - k) != set.end())
      continue;
    if (A>B-k)
      continue;
    set.insert(B-k);

    cout << B - k << endl;
  }

}


Measured memory_bytes: 256