akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 100000000000000 //10^14
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

ll gcd(ll a, ll b) {
    return b ? gcd(b, a%b) : a;
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

ll nlcm(vector<ll> numbers) {
    ll res;
    res = numbers.at(0);
    rep2(i, 1, sz(numbers)){
        res = lcm(res, numbers.at(i));
    }
    return res;
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> T(N);
    rep(i, N) cin >> T.at(i);
    cout << nlcm(T) << endl;
}

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

const int nmax=100005;
vector<int> A[nmax],B[nmax];

void DFS(int u,int N,int color[nmax]){
    bool check=true;
    for(int i=0;i<N;i++){
        if(color[i]==0){
            check=false;
            break;
        }
    }
    if(check){
        for(int i=0;i<N;i++){
            cout<<color[i]%2<<endl;
        }
        return;
    }
    for(int i=0;i<A[u].size();i++){
        if(color[A[u][i]]==0){
            color[A[u][i]]=color[u];
            DFS(A[u][i],N,color);
        }
    }
    for(int i=0;i<B[u].size();i++){
        if(color[B[u][i]]==0){
            color[B[u][i]]=color[u]%2+1;
            DFS(B[u][i],N,color);
        }
    }
    return;
}

int main(){

        int N;
        cin>>N;
        for(int i=0;i<N-1;i++){
            int x,y,z;
            cin>>x>>y>>z;
            if(z%2==0){
                A[x-1].push_back(y-1);
                A[y-1].push_back(x-1);
            }
            else if(z%2==1) {
                B[x-1].push_back(y-1);
                B[y-1].push_back(x-1);
            }
            
        }
        
        int color[nmax];
    for(int i=0;i<N;i++){
        color[i]=0;
    }
        color[0]=2;
        DFS(0,N,color);
    }



Measured memory_bytes: 13696
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <utility>
#include <stack>
#include <string.h>
#include <complex>
using namespace std;

const int INF = 1<<29;
const double EPS = 1e-8;
typedef vector<int> vec;
typedef pair<int,int> P;
struct edge{int to,cost;};

struct State{
    int d,o,y,x,l,r;
    bool operator<(const State& right) const{
        return d == right.d ? o < right.o : d > right.d;
    }
};

const int dx[] = {-1,1,0};
const int dy[] = {0,0,1};
int field[10][10];
int d[51][10][10][10][10];

int main(){
    while(1){
        int W,H;
        scanf("%d%d",&W,&H);
        if(!W)break;

        int f,m,o;
        scanf("%d%d%d",&f,&m,&o);
        for(int i=0;i<H;i++){
            for(int j=0;j<W;j++){
                scanf("%d",&field[i][j]);
            }
        }

        for(int i=0;i<51;i++){
            for(int j=0;j<10;j++){
                for(int k=0;k<10;k++){
                    for(int l=0;l<10;l++){
                        fill(d[i][j][k][l],d[i][j][k][l]+10,INF);
                    }
                }
            }
        }

        priority_queue<State> que;
        for(int i=0;i<W;i++){
            int no = o-1, nd = 0;
            if(no<=0) continue;
            if(field[0][i]<0) nd -= field[0][i];
            else no = min(m, no+field[0][i]);
            d[no][0][i][i][i] = nd;
            que.push((State){nd,no,0,i,i,i});
        }

        int ans = -1;
        while(que.size()){
            State p = que.top(); que.pop();
            if(d[p.o][p.y][p.x][p.l][p.r]<p.d) continue;
            if(p.d>f)break;
            if(p.y==H-1){
                ans = p.d;
                break;
            }

            for(int i=0;i<3;i++){
                int nx = p.x + dx[i], ny = p.y + dy[i];
                if(nx<0||W<=nx||ny<0||H<=ny) continue;
                int nl = min(p.l, nx), nr = max(p.r, nx);
                int no = p.o - 1;
                if(no <= 0) continue;
                int nd = p.d;
                if(i==2){
                    nl = nx; nr = nx;
                }
                if(i==2 || nx < p.l || p.r < nx){
                    if(field[ny][nx]<0) nd -= field[ny][nx];
                    else no = min(m, no+field[ny][nx]);
                }
                if(d[no][ny][nx][nl][nr] > nd){
                    d[no][ny][nx][nl][nr] = nd;
                    que.push((State){nd, no, ny, nx, nl, nr});
                }
            }
        }
        if(ans==-1) cout << "NA" << endl;
        else cout << ans << endl;
    }

    return 0;
}

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

using namespace std;

int main() {
	long long n, a, b;
	ignore = scanf("%lld %lld %lld", &n, &a, &b);
	if (a % 2 == b % 2) {
		printf("%lld\n", (b - a) / 2);
	}
	else {
		long long x = (a - 1) + 1 + (b - a - 1) / 2;
		long long y = (n - b) + 1 + (b - a - 1) / 2;
		printf("%lld\n", min(x, y));
	}
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { 0, -1, 1, 0 };
const ll dy[4] = { -1, 0, 0, 1 };
const ll INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
///////////////////////////////////////

//元の列で奇数番目に現れソート列で偶数番目に現れる要素の個数をXとする。
//明らかにこれは元の列で偶数番目に現れソート列で奇数番目に現れる要素の個数と等しい
//以下をX回繰り返す
//元の列で奇数番目に現れソート列で偶数番目に現れる要素を一つとってA,逆に元の列で偶数番目に
//現れソート列で奇数番目に現れる要素を一つとってBとする
//これに適当な回数の操作を加えAを数列の1番目にBを2番目に持ってくることができる
//ここで前者の操作でAとBを入れ替える
int main() {
	int N; cin >> N;
	vector<int>a(N);
	vector<int>b(N);
	map<int, int>p;
	REP(i, N) {
		cin >> a[i];
		b[i] = a[i];
	}
	sort(a.begin(), a.end());
	REP(i, N) {
		p[a[i]] = i;
	}
	int ans = 0;
	for (int i = 0; i < N; i += 2) {
		if (p[b[i]] % 2 == 1) {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5760
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,d1,d2,count;
  cin >> n;
  count = 0;
  for(int i= 0; i < n; i++){
    cin >> d1 >> d2;
    if(d1==d2){
      count++;
    }
    else{
      count = 0;
    }
    
    if(count==3){
      cout << "Yes" <<endl;
      return 0;
    }
  }
  
  cout << "No" <<endl;
}

Measured memory_bytes: 3620
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <cassert>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int,int>> vii;

class atcA {
public:
    void solve(istream& in, ostream& out) {
        int N;
        in >> N;
        
        vector<int64_t> A(N), B(N);
        for (int i = 0; i < N; ++i) {
            in >> A[i] >> B[i];
        }
        
        int64_t val = 0;
        for (int i = N-1; i >= 0; --i) {
            A[i] += val;
            val += B[i] - (A[i] % B[i] == 0 ? B[i] : (A[i] % B[i]));
        }
        
        out << val << endl;
    }
};


int main() {
	std::ios::sync_with_stdio(false);

	atcA solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
#define all(v) (v).begin(), (v).end()
const int N=3e5+10;
int mod=1000000007;
const int inf=1e9+1;


int power(int a,int b) {int ans=1; while(b){if(b&1)ans=(ans*a)%mod;b/=2;a=(a*a)%mod;}return ans;}
int bit(int n){if(n==0)return 0;int k=1,b=0;while((n/k)!=0){k*=2;b++;}return b-1;}

int n,t,k,m,x,y,z,flag=1;
string s;


void solve(){
    
}
    

int32_t main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
//    cin>>t;
//    while(t--){
        cin>>n;
        string s;
        fo(i,n){
        	s+="ACL";
        }
        cout<<s;
//    }
    

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 3840
import copy

words = lambda t : list(map(t, input().split()))
n,k = words(int)
s = input()

if n == 1:
    print(0)
    exit()

t = list(copy.copy(s))
x = k
i = 0
while i < len(t) and t[i] == "L":
    i += 1
while x > 0 and i < len(t):
    if t[i] == "L":
        x -= 1
        while i < len(t) and t[i] == "L":
            t[i] = "R"
            i+=1
    else:
        i+= 1

if x > 0 and t[0] == "L":
    i = 0
    while i < len(t) and t[i] == "L":
        t[i] = "R"
        i += 1

#print(t)
def calcAns(t):
    ans = 0
    for i in range(1,len(t)-1):
        #print(t[i])
        if t[i] == "L":
            if t[i-1] == "L":
                ans += 1
        elif t[i] == "R":
            if t[i+1] == "R":
                ans += 1
    if t[0] == "R" and t[1] == "R":
        ans += 1
    if t[-1] == "L" and t[-2] == "L":
        ans += 1
    return ans

ansR = calcAns(t)
#print(ansR)

t = list(copy.copy(s))
x = k
i = 0
while i < len(t) and t[-(i+1)] == "R":
    i += 1

while x > 0 and i < len(t):
    if t[-(i+1)] == "R":
        x -= 1
        while i < len(t) and t[-(i+1)] == "R":
            t[-(i+1)] = "L"
            i+=1
    else:
        i+= 1

if x > 0 and t[-1] == "R":
    i = 0
    while i < len(t) and t[-(i+1)] == "R":
        t[-(i+1)] = "L"
        i += 1

#print(t)
ansL = calcAns(t)
#print(ansL)

print(max(ansL,ansR))


Measured memory_bytes: 56460
#include <bits/stdc++.h>
#define watch(x) cerr << (#x) << " is " << (x) << endl
const int mod = 1e9 + 7;

using namespace std;



int main()
{
	#ifdef ME
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif

	int n, m;
	cin >> n >> m;

	cout << n*m << endl;

	return 0;
}

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

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define FORR(i, a, b) for(int i = (a); i > (b); --i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define mp make_pair
#define bitcnt __builtin_popcount
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"

typedef long long ll;
typedef vector<int> V;
typedef vector<ll> VL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef priority_queue<int> PQ;
typedef priority_queue<int, V, greater<int>> PQG;

const int INF = 1e9;
const int MOD = 998244353;
const ll LINF = 1e18;

int N;
vector<int> C, S, F;

int main() {
    cin >> N;
    C.resize(N - 1);
    S.resize(N - 1);
    F.resize(N - 1);
    REP(i, N - 1) { cin >> C[i] >> S[i] >> F[i]; }
    REP(i, N - 1) {
        int now = i;
        ll time = S[i] + C[i];
        now++;
        while(now < N - 1) {
            if(time <= S[now]) {
                time = S[now] + C[now];
            } else {
                if(time % F[now] == 0) {
                    time += C[now];
                } else {
                    time = (time / F[now] + 1) * F[now] + C[now];
                }
            }
            now++;
        }
        cout << time << "\n";
    }
    cout << "0"
         << "\n";
    return 0;
}


Measured memory_bytes: 256
# Contest No.: ABC167
# Problem No.: A
# Solver:      JEMINI
# Date:        20200510

import sys

def main():
    s = input()
    t = input()
    ans = True
    for i in range(len(s)):
        if s[i] != t[i]:
            ans = False
            break
    if ans:
        print("Yes")
    else:
        print("No")
    return

if __name__ == "__main__":
    main()

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

using namespace std;


void solve() {
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a,a+3);
    int x=a[2]-a[1],y=a[2]-a[0];
    int res = (x+y+1)/2 + ((x+y)&1);
    cout << res;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    cout << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define pb push_back
#define fi first
#define se second 
#define mp make_pair
#define int long long
signed main()
{
    IOS
    int n; cin>>n;
    double arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    double Dr = 0,ans;
    for(int i=0;i<n;i++)
    {
        Dr += 1/arr[i];
    }
    ans = 1/Dr;
    cout<<fixed<<setprecision(20)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3

def string_three_numbers_spliter():
    a, b, c = [int(i) for i in input().split()]
    return a, b, c


def main():
    a, b, c = string_three_numbers_spliter()

    if a < b and a < c:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Measured memory_bytes: 7736
#include <stdio.h>

int main(){

  int x,y,i,d;

  /* Using loop to check input numbers are in constrants or not */
  while(1){
    scanf("%d %d", &x,&y);
    if(x>=1 && y<=1000000000)break;
    else printf("error!\n");
  }

  /* make three situations x>y, x<y and x=y */
  if(x>y){
    d=x%y;
    for(i=d ; i>0 ; i--){
      if(y%i==0 && d%i==0)break;
    }
  }
  else if(x<y){
    d=y%x;
    for(i=d ; i>0 ; i--){
      if(x%i==0 && d%i==0) break;
    }
  }
  else i=x;

  /* output the greatest common divisor */
  printf("%d\n", i);

  return 0;
}



Measured memory_bytes: 2140
#include<stdio.h>

long plus(int *a,long s,long e){
	long sum,c;
	c=s;
	sum=0;
	while(c<=e){
		sum+=(long)a[c];
		c++;
	}
	return sum;
}

int main(){
	int a[100000];
	long sum,max,n,k,i;
	scanf("%ld %ld",&n,&k);
	while(n!=0){
		for(i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		max=plus(a,0,k-1);
		sum=max;
		for(i=1;i<n-k+1;i++){
			sum=sum-(long)a[i-1]+(long)a[i+k-1];
			max=sum>max?sum:max;
		}
		printf("%ld\n",max);
		scanf("%ld %ld",&n,&k);
	}
	return 0;
}

Measured memory_bytes: 992
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include<iomanip>

using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
const int inf = 1000000;

int main(int argc, const char * argv[]) {
  int a, b, h;
  cin >> a >> b >> h;
  cout << (a + b) * h / 2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
#define MAX 200000

int main() {
    int n;
    vector<int> a(MAX+10);
    int sum = 0;
    
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum ^= a[i];
    }

    for (int i = 0; i < n; i++) cout << (sum ^ a[i]) << ' ';
    cout << endl;
}

Measured memory_bytes: 3864
/*
 * Author : anaksoleh
 * 18 September 2019
 */

#include <bits/stdc++.h>
using namespace std;

const int SIZE = 1e5 + 10;

int N,K,Q;
map<int, int> player;
int score[SIZE];

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

	cin >> N >> K >> Q;
	fill(score + 1,score + 1 + N,K);
	
	int val;
	for(int i = 1 ; i <= Q ; i++){
		cin >> val;
		player[val]++;
	}

	int correct;
	for(int i = 1 ; i <= N ; i++){
		correct = player[i];
		score[i] = score[i] + correct - Q;
		if(score[i] > 0){
			cout << "Yes" << '\n';
		}else cout << "No" << '\n';
	}

	return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
int a[1000],dp[100010],n,k;
void solve(){
    cin>>n>>k;
    for(int i=0;i<n;i++)
        cin>>a[i];
    for(int i=0;i<=k;i++)
        for(int j=0;j<n;j++)
            if(i>=a[j])dp[i]=max(dp[i],1-dp[i-a[j]]);
    if(dp[k])cout<<"First";
    else cout<<"Second";
}
main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);

    //freopen("FORMMAU.inp","r",stdin);
    //freopen("FORMMAU.out","w",stdout);

    //srand(time(0));

    cout << setprecision(20) <<fixed;

    //int t;cin>>t;while(t--)

    solve();
}


Measured memory_bytes: 640
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
//#include <intrin.h>  //AtCoder (gcc) 上ではこれがあると動かない。__popcnt用のincludeファイル。
using namespace std;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(int i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const int INF = 2000000000; //2e9
//const int large_P = 1000000007; //1e9 + 7
const int large_P = 998244353; //1e9 + 7



//繰り返し2乗法
//N^aの、Mで割った余りを求める。
ll my_pow(ll N, ll a, ll M) {
	ll tempo;
	if (a == 0) {
		return 1;
	}
	else {
		if (a % 2 == 0) {
			tempo = my_pow(N, a / 2, M);
			return (tempo * tempo) % M;
		}
		else {
			tempo = my_pow(N, a - 1, M);
			return (tempo * N) % M;
		}
	}
}



//N_C_a を M で割った余り
ll my_combination(ll N, ll a, ll M) {
	ll answer = 1;

	rep(i, a) {
		answer *= (N - i);
		answer %= M;
	}

	rep(i, a) {
		answer *= my_pow(i + 1, M - 2, M);
		answer %= M;
	}

	return answer;
}





const int N_max = 200000;
int dp[N_max + 3];
int combination[N_max + 3]; // (N - 1)_C_i
int power[N_max + 3]; // (M - 1)^i


signed main() {
	int N, M, K;
	cin >> N >> M >> K;
	int res = 0;

	power[0] = 1;
	combination[0] = 1;

	for (int i = 1; i <= N; i++) {
		power[i] = power[i - 1] * (M - 1);
		power[i] %= large_P;

		combination[i] = combination[i - 1] * (N - i);
		combination[i] %= large_P;
		
		combination[i] *= my_pow(i, large_P - 2, large_P);
		combination[i] %= large_P;
	}




	for(int i = 0; i <= K; i++) {
		dp[i] = power[N - 1 - i];
		dp[i] *= M;
		dp[i] %= large_P;

		dp[i] *= combination[i];
		dp[i] %= large_P;
	}

	rep(i, K + 1) {
		res += dp[i];
		res %= large_P;
	}


	cout << res << endl;
	
}

Measured memory_bytes: 8284
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
const long long INF = 1LL << 60;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  ll D;
  cin >> D;
  vector<ll> c(26);
  rep(i,26) cin >> c[i];
  vector<vector<ll>> s(D,vector<ll>(26));
  rep(i,D)
  {
    rep(j,26)
    {
      cin >> s[i][j];
    }
  }
  vector<int> t(D);
  vector<int> lastday(26);
  rep(i,26) lastday[i] = -1;
  rep(i,D)
  {
    ll M = 0;
    ll m = 0;
    rep(j,26)
    {
      if(i - lastday[j]>=26)
      {
        t[i] = j;
        break;
      }
      M = max(M,s[i][j]);
      if(M!=m)
      {
        t[i] = j;
      }
      m = M;
    } 
  }
  ll satisfy = 0;
  rep(i,D)
  {
    ll dissatisfy = 0;
    satisfy += s[i][t[i]];
    lastday[t[i]] = i;
    rep(j,26)
    {
      dissatisfy += c[j] * (i-lastday[j]);
    }
    satisfy -= dissatisfy;
  }
  rep(i,D)
  {
    cout << (i+7)%26 + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <cstdio>
#include <cmath>
#include <queue>
#include <map>
#include <cstring>
#include <string>
#include <set>
#include <vector>
#include <list>
#include <deque>
#include <algorithm>
#include <stack>
#include <numeric>
#include <time.h>
#include<iomanip>
#include<sstream>
using namespace std;
const long long inf = 0x7f7f7f7f;
long long GCD(long long a, long long b) { return 0 == b ? a : GCD(b, a%b); }
const long long mod = 1e9 + 7;
const double pi = acos(-1);
char inp[210000];
int a, b, c, d;
bool check(int x, int y)
{
	if (x == y)
		return 1;
	if (x + 1 <= y && inp[x + 1] == '.')
		return check(x + 1, y);
	else if (x + 2 <= y && inp[x + 2] == '.')
		return check(x + 2, y);
	return 0;
}
int main()
{
	//ios_base::sync_with_stdio(false);
	int n;
	cin >> n >> a >> b >> c >> d;
	scanf("%s", inp + 1);
	int ans = 0;
	if (c < d)
	{
		if (check(b, d) && check(a, c))
			ans = 1;
		else
			ans = 0;
	}
	else
	{
		ans = 1;
		while (1)
		{
			int fl = 0;
			if (a != c)
			{
				if (a + 1 <= c && a + 1 != b && inp[a + 1] == '.')
					a++, fl = 1;
				else if (a + 2 <= c && a + 2 != b && inp[a + 2] == '.')
					a += 2, fl = 1;
				else if (b + 1 <= d && b + 1 != a && inp[b + 1] == '.')
					b++, fl = 1;
				else if (b + 2 <= d && b + 2 != a && inp[b + 2] == '.')
					b += 2, fl = 1;
			}
			else
			{
				inp[c] = '#';
				ans = check(b, d);
				break;
			}
			if (!fl)
			{
				ans = 0;
				break;
			}
		}
	}
	if (ans)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;


struct Edge{int to, id;};
using Graph = vector<vector<Edge>>;
Graph G;
vector<int> ans;

void dfs(int v, int c = -1, int p = -1){
    int k = 1;
    rep(i,G[v].size()){
        int u = G[v][i].to, ei = G[v][i].id;
        if(u==p)continue;
        if(k==c)++k;
        ans[ei] = k; k++;
        dfs(u,ans[ei],v);
    }
}

int main(){
    int n; cin >> n;
    G.resize(n);
    ans = vector<int>(n-1);
    rep(i,n-1){
        int a, b;
        cin >> a >> b;
        --a,--b;
        G[a].push_back(Edge{b,i});
        G[b].push_back(Edge{a,i});
    }
    dfs(0);
    int mx = 0;
    rep(i,n) mx = max(mx,int(G[i].size()));
    cout << mx << endl;
    rep(i,n-1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 8320
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
 
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
// #define exit(a, b) return cout << a, b;
 
// debugger
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cout << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define debug(stuff) cout << #stuff << ": " << stuff <<endl
#define debugc(stuff) cout << #stuff << ": "; for(auto x: stuff) cout << x << " "; cout << endl;
// 
 
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define all(v) v.begin(), v.end() 
 
#define print(stuff) cout << stuff << endl
#define printc(stuff) for(auto x: stuff) cout << x << " "; cout << endl;
#define printPrec(stuff) cout << fixed << setprecision(15) << stuff << endl;
#define len length
#define ret0 return 0
#define ret return 
 
 
#define ll long long
#define ld long double
#define fi first
#define endl '\n'
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define fill(ar, x) memset(ar, x, sizeof ar)
 
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,
// tree_order_statistics_node_update> indexed_set;
 
#define inf (long long int) 1e18
#define eps 0.000001
#define mod 1000000007
#define mod1 998244353
#define MAXN (ll)2e5+5
#define N (1ll<<10)

void solve(){
    string s;
    cin>>s;
    loop(i,0,3){
        if(s[i]-'0' == 7){
            print("Yes");
            ret;
        }
    }
    print("No");
}
 
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #ifndef ONLINE_JUDGE
        start_routine();
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
 
    ll t = 1;
    // cin>>t;
    while(t--){
        solve();
    }
        
    #ifndef ONLINE_JUDGE
        end_routine();
    #endif
}


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


int main(void){
    int h, w;
    cin>>h>>w;
    vector <string> s(h);
    rep(i, h) cin>>s[i];
    vector<vector<int> > vertical(w+1);
    vector<vector<int> > horizontal(h+1);
    rep(j, w){
        vertical[j+1].push_back(0);
        rep(i, h){
            if(s[i][j]=='#') vertical[j+1].push_back(i+1);
        }
        vertical[j+1].push_back(h+1);
    }
    rep(i, h){
        horizontal[i+1].push_back(0);
        rep(j, w){
            if(s[i][j]=='#') horizontal[i+1].push_back(j+1);
        }
        horizontal[i+1].push_back(w+1);
    }
    int ans=0;
    for(int i=1;i<=h;i++){
        rep(j, horizontal[i].size()-1){
            int now=horizontal[i][j+1]-horizontal[i][j]-1;
            for(int k=horizontal[i][j]+1;k<=horizontal[i][j+1]-1;k++){
                if(k==0) continue;
                if(s[i-1][k-1]=='#') continue;
                auto u=lower_bound(vertical[k].begin(), vertical[k].end(), i);
                now+=*(u)-*(u-1)-2;
                //cout<<k<<" "<<*u<<" "<<*(u-1)<<" "<<now<<endl;
                ans=max(now, ans);
                now=horizontal[i][j+1]-horizontal[i][j]-1;
            }
        }
    }
    cout<<ans<<endl;
    return 0;

}

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

UL N;
int A[500000];

void maxHeapify(UL i){
 UL l = (i<<1)+1;
 UL r = (i<<1)+2;
 UL largest;
 if(l<N && A[l]>A[i]) largest = l;
 else largest = i;
 if(r<N && A[r]>A[largest]) largest = r;

 if(largest != i){
  swap(A[i],A[largest]);
  maxHeapify(largest);
 }
}

void buildMaxHeap(){ for(UL i=(N-1)/2; i!=~0; i--) maxHeapify(i); }

int main() {
 scanf("%u",&N);
 rep(i,N) scanf("%d",&A[i]);
 buildMaxHeap();
 rep(i,N) printf(" %d",A[i]); printf("\n");
 return 0;
}



Measured memory_bytes: 5148
X, Y = map(int, input().split())

result = 0

if X == 1:
    result = 300000
elif X == 2:
    result = 200000
elif X == 3:
    result = 100000

if Y == 1:
    result += 300000
elif Y == 2:
    result += 200000
elif Y == 3:
    result += 100000

if X == 1 and Y == 1:
    result += 400000

print(result)


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cstdint>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
#define MP make_pair
#define PB push_back
#define inf 1000000007
#define mod 1000000007
#define rep(i,n) for(int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()

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

template<class T> inline bool chmin(T &a, T b){
    if(a>b){
        a = b;
        return true;
    }
    return false;
}
#define int long long
signed main(){
    int n,d,t;
    cin >> n >> d >> t;
    vector<pair<int,int> > s;
    rep(i,n){
        int x,h;
        cin >> x >> h;
        s.PB(MP(x,h));
    }
    sort(s.begin(),s.end());
    vector<int>a(n),b(n);
    vector<int>c(n+10);
    rep(i,n){
        a[i] = s[i].first;
        b[i] = s[i].second;
    }
    a.push_back((1LL<<60));
    int sm = 0;
    rep(i,n){
        if(i!=0)c[i] += c[i-1];
        if(b[i]<=c[i])continue;
        int k = upper_bound(all(a),a[i]+2*d)-a.begin();
        int dd = (b[i]-c[i]+t-1)/t;
        c[i] += t*dd;
        c[k] -= t*dd;
        sm += dd;
    }
    cout << sm << endl;
    return 0;
}

Measured memory_bytes: 11372
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define _printV(vec) for(int i = 0; i < SZ(vec); i++){cout << vec[i];if (i==SZ(vec)-1){cout<<endl;}else{cout << " ";}}
#define printV(vec) cout<<#vec<<":";_printV(vec)
#define _printA(arr,n) for(int i = 0; i < n; i++){cout << arr[i];if (i==n-1){cout<<endl;}else{cout << " ";}}
#define printA(arr) cout<<#arr<<":";_printA(arr,sizeof(arr)/sizeof(arr[0]))
#define LLINF = (1LL<<62)
#define puts(var) cout<<#var<<":"<<var<<" "
typedef long long ll;

int main()
{
  int N;
  cin >> N;
  int T,A;
  cin >> T >> A;
//   vector<int> H(N);
  float minval = std::numeric_limits<float>::infinity();
  int minidx = 0;
  int x;
  REP(i,N){
    cin >> x;
    float tmp = T-x*0.006;
    float val = abs(tmp - A);
    if(minval > val){
      minval = val;
      minidx = i;
    }
  }


  printf("%d",minidx+1);

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <array>

int main(int argc, char *argv[]){
    int N, K;
    std::cin >> N >> K;
    int sum = 0;
    int h;
    for(int i=0; i<N; ++i){
        std::cin >> h;
        if(h>=K){
            ++sum;
        }
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)
#define RREP(i, n) for(ll i = n - 1; i >= 0; i--)
#define REP2(i, n, k) for(ll i = 0; i < n; i += k)




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

	ll ans = 0;
	for (ll i = 1; i <= n; i += 2) {
		ll c = 1, t = i;
		for (ll j = 2; j <= i; j++) {
			if (i % j == 0) {
				c++;
			}
		}
		if (c == 8) {
			ans++;
		}
	}
	cout << ans << endl;
}

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

int main(int argc, char **argv)
{
	string n;
  ll k;
  cin>>n;
  cin>>k;
  set <ll> arr;
  for(ll i=0;i<k;i++){
    ll x;
    cin>>x;
    arr.insert(x);
  }
  
  // checking for the case when the n is fine
  ll flag=1;
  for(ll i=0;i<n.size();i++){
    ll temp=n[i]-'0';
    if (arr.find(temp)!=arr.end()){
      flag=0;
      break;
    }
  }
  
  if (flag) {
    cout<<n<<"\n";
    return 0;
  }
  
  ll num=stoi(n);
  //cout<<"pika"<<"\n";
  while(num){
    ll ok=1;
    ll temp=num;
    while(temp!=0){
      ll digit=temp%10;
      temp=temp/10;
      //cout<<digit<<" "<<temp<<"\n";
      if (arr.find(digit)!=arr.end()){
        ok=0;
        break;
      }
    }
    if (ok){
      cout<<num<<"\n";
      return 0;
    }
    num++;
  }
  
	return 0;
}


Measured memory_bytes: 3576
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define in insert
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll INF = 1e9 + 7;
int n, k;
vector<vi> adj;
ll ans;
void dfs(int u, int p, bool q){
    int c;
    if(q){
        q = false;
        c = k-1;
    } 
    else c = k-2;
    for(auto v : adj[u]){
        if(v == p) continue;
        ans *= (ll)c;
        ans %= INF;
        c--;
        dfs(v, u, q);
    }
}
int main(){
    cin >> n >> k;
    ans = k;
    adj.resize(n+1, vi());
    for(int i = 1; i < n; i++){
        int x, y;
        cin >> x >> y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    dfs(n/2, -1, true);
    cout << ans;
}


Measured memory_bytes: 11648
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;
//const int mod = 998244353;

int digit(int n)
{
    int res = 0;
    while (n > 0)
    {
        res += n % 10;
        n /= 10;
    }
    return res;
}

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

    int m;
    cin >> m;
    vector<P> v(m);
    rep(i, m) cin >> v[i].first >> v[i].second;
    int ans = 0;
    rep(i, m)
    {
        int d = v[i].first, c = v[i].second;
        int tmp = 0;
        bool f = false;
        while (c > 1)
        {
            if (c % 2 == 1)
            {
                if (f)
                    ans++;
                f = true;
                tmp += d;
                c /= 2;
                d *= 2;
            }
            else
            {
                c /= 2;
                d *= 2;
            }
            ans += c;
            while (d > 9)
            {
                d = digit(d);
                ans += c;
            }
            if (tmp > 9)
            {
                ans++;
                tmp = digit(tmp);
            }
        }
        if (f)
        {
            d += tmp;
            ans++;
            while (d > 9)
            {
                d = digit(d);
                ans++;
            }
        }
        v[i] = {d, c};
    }
    int sum = 0;
    ans--;
    rep(i, m)
    {
        ans++;
        sum += v[i].first;
        while (sum > 9)
        {
            sum = digit(sum);
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3456
import math

n,d = map(int,input().split())
points = []
ans = 0

for i in range(n):
    x = list(map(int,input().split()))
    points.append(x)

for i in range(n):
    for j in range(i+1,n):
        dis = 0
        dis_sq = 0
        for k in range(len(points[i])):
            dis = dis+((points[i][k]-points[j][k])**2)
        dis_sq = int(math.sqrt(dis))
        if dis == dis_sq**2:
            ans = ans+1

print(ans)


Measured memory_bytes: 3064
#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.at(i);
  
  vector<double> exv(1000, 0);
  for(double i = 0; i < 1000; i++){
    exv.at(i) = (2 + i) / 2;
  }
  
  double ans;
  double sum = 0;
  for(int i = 0; i < k; i++){
    sum += exv.at(p.at(i) - 1);
  }
  ans = sum;
  
  for(int i = k; i < n; i++){
    sum += exv.at(p.at(i) - 1);
    sum -= exv.at(p.at(i - k) - 1);
    ans = max(ans, sum);
  }
  
  cout << fixed << setprecision(10);
  cout << ans << endl;
}

Measured memory_bytes: 1024
N = int(input())
S = input()

count = [0] * N
e_cnt = 0

for i in range(N):
    if S[i] == "W":
        e_cnt += 1
    count[i] += e_cnt

w_cnt = 0

for i in reversed(range(N)):
    if S[i] == "E":
        w_cnt += 1
    count[i] += w_cnt

ans = min(count) - 1

print(ans)


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

int main(){
    int n, m; cin >> n >> m;
    vector<ll> h(n);
    for(int i = 0; i < n; i++) cin >> h[i];
    int a, b;
    vector<int> good(n);
    for(int i = 0; i < n; i++) good[i] = 1;
    for(int i = 0; i < m; i++){
        cin >> a >> b;
        if(h[a-1] < h[b-1]) good[a-1] = 0;
        else if(h[a-1] > h[b-1]) good[b-1] = 0;
        else good[a-1] = good[b-1] = 0;
    }
    int ans = 0;
    for(int i = 0; i < n; i++) ans += good[i];
    cout << ans << endl;
}

Measured memory_bytes: 4544
n, a, b = map(int, input().split())

mod = 1000000007

def modpow(a, p):
  if p == 0:
    return 1
    
  if p % 2 == 0:
    x = modpow(a, p//2) % mod
    ans = x * x % mod
  else:
    ans = a * modpow(a, p-1) % mod
  
  return ans

def modcombi(x, y):
  if x < y:
    return 0
  elif y == 0:
    return 1
  elif y > x-y:
    return modcombi(x, x-y)
  
  num = 1
  denom = 1
  
  for i in range(y):
    num *= (x-i)
    num %= mod
    denom *= (i+1)
    denom %= mod
  
  ans = num * modpow(denom, mod-2)
  return ans % mod

print( ( 2 * mod + modpow(2,n) - modcombi(n, a) - modcombi(n, b) ) % mod - 1)

Measured memory_bytes: 3064
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <tuple>
# include <functional>
# include <utility>
# define INF 1000000000
# define MOD 1000000000+7
using namespace std;

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



Measured memory_bytes: 768
/*
 *  author: chw0501
 *  reference: 
 *  created: 25.04.2020 01:44:29(UTC)
*/
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define MOD 1000000007 
#define INF 987654321 

int n;
ll arr[16][16];
ll sum[1<<16];
ll dp[1<<16];

//dp[s]: s집합이 남아있을 때 앞으로 얻을 수 있는 최대점수
ll solve(int s){
	ll& ret=dp[s];
	if(ret!=-1ll) return ret;
	if(s==0) return ret=0;
	ret=0;
	for(int i=s;i>0;i=(i-1)&s){
		ret=max(ret,sum[i]+solve(s-i));
	}
	return ret;
}

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			scanf("%lld",&arr[i][j]);
		}
	}
	for(int i=1;i<(1<<n);i++){
		vector<int> v;
		for(int j=0;j<n;j++){
			if(((1<<j)&i) !=0){
				v.push_back(j);
			}
		}
		for(int x:v){
			for(int y:v){
				sum[i]+=arr[x][y];
			}
		}
		sum[i]/=2ll;
	}
	memset(dp,-1ll,sizeof(dp));
	cout<<solve((1<<n)-1);
	return 0;
}

Measured memory_bytes: 1280
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy
 
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int k, x;
    cin >> k >> x;
    for (int i = x - k + 1; i <= x + k - 1; ++i) {
        cout << i << " ";
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,N) for (int i = 0; i < (N); ++i)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main(void){
  int N;
  string S, T;
  cin >> N >> S >> T;

  rep(i,N) cout << S.at(i) << T.at(i);
  cout << endl;
}


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

int main()
{
  int N,k;
  cin >> N >> k;
  vector<int> l(N);
  for (int i = 0; i < N; i++)
  {
    cin >> l.at(i);
  }
  sort(l.begin(), l.end());
  reverse(l.begin(), l.end());

  int sum = 0;
  for (int i = 0; i < k; i++)
  {
    sum += l.at(i);
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner t=new Scanner(System.in);
		int a=t.nextInt(), b=t.nextInt(), c=t.nextInt();
		while(a != b && c !=0) {
			b = b +1;
			c = c-1;
			}
		System.out.println(c);
		
	}
	}

Measured memory_bytes: 21972
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class D
{
	public static void Main() => (new Solver()).Solve();
}

public class Solver
{
	public void Solve()
	{
		int H = GetInt();
		int W = GetInt();
		char[,] grid = new char[H, W];
		for(int i = 0; i < H; i++)
		{
			string S = GetString();
			for(int j = 0; j < W; j++)
				grid[i, j] = S[j];
		}

		int V = H * W;
		var adj = Enumerable.Range(0, V).Select(_ => new List<int>()).ToArray();

		int[] di = new int[4] { -1, 0, 1, 0 };
		int[] dj = new int[4] { 0, -1, 0, 1 }; 
		for(int i = 0; i < H; i++)
		{
			for(int j = 0; j < W; j++)
			{
				if(grid[i, j] == '#')
					continue;
				
				int v = i * W + j;
				for(int k = 0; k < 4; k++)
				{
					int ni = i + di[k];
					int nj = j + dj[k];
					if(ni < 0 || ni >= H || nj < 0 || nj >= W || grid[ni, nj] == '#')
						continue;

					int u = ni * W + nj;
					adj[v].Add(u);
				}
			}
		}

		int ans = 0;
		for(int i = 0; i < V; i++)
			chmax(ref ans, bfs(V, adj, i));

		WriteLine(ans);
	}

	private int bfs(int V, List<int>[] adj, int s)
	{
		int max = 0;
		int[] d = Enumerable.Repeat(int.MaxValue / V, V).ToArray();
		bool[] visited = new bool[V];
		d[s] = 0;
		visited[s] = true;
		var queue = new Queue<int>();
		queue.Enqueue(s);
		while(queue.Count > 0)
		{
			int v = queue.Dequeue();
			foreach(int u in adj[v])
			{
				if(visited[u])
					continue;

				visited[u] = true;
				d[u] = d[v] + 1;
				chmax(ref max, d[u]);
				queue.Enqueue(u);
			}
		}
		return max;
	}


}

public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => Enumerable.Range(0, (int)N).Select(_ => GetInt()).ToArray();
	public static long[] GetLongs(long N) => Enumerable.Range(0, (int)N).Select(_ => GetLong()).ToArray();
	public static double[] GetDoubles(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDouble()).ToArray();
	public static decimal[] GetDecimals(long N) => Enumerable.Range(0, (int)N).Select(_ => GetDecimal()).ToArray();
	public static string[] GetStrings(long N) => Enumerable.Range(0, (int)N).Select(_ => GetString()).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) < 0)
			x = y;
	}

	public static void chmin<T>(ref T x, T y) where T : IComparable<T>
	{
		if(x.CompareTo(y) > 0)
			x = y;
	}

	public static void swap<T>(ref T x, ref T y)
	{
		T tmp = x;
		x = y;
		y = tmp;
	}
}

Measured memory_bytes: 15572
unittest
{
	assert( [ "4 4", "1 4", "3 3", "6 2", "8 1" ].parse.expand.solve == 21 );
	assert( [ "4 2", "0 0", "1 1", "2 2", "3 3" ].parse.expand.solve == 1 );
	assert( [ "4 3", "-1000000000 -1000000000", "1000000000 1000000000", "-999999999 999999999", "999999999 -999999999" ].parse.expand.solve == 3999999996000000001 );
}



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

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nk = input.front.split.to!( long[] );
	auto xys = new long[ 2 ][ nk[ 0 ] ];
	foreach( ref xy; xys )
	{
		input.popFront;
		xy = input.front.split.to!( long[] );
	}
	return tuple( nk[ 1 ], xys );
}

auto solve( long k, long[ 2 ][] xys )
{
	auto xs = new long[ xys.length ];
	auto ys = new long[ xys.length ];
	foreach( ref x, ref y, xy; lockstep( xs, ys, xys ) )
	{
		x = xy[ 0 ];
		y = xy[ 1 ];
	}
	xs.sort();
	ys.sort();
	
	auto ans = long.max;
	foreach( xi, xa; xs )
	{
		foreach( xb; xs[ xi .. $ ] )
		{
			foreach( yi, ya; ys )
			{
				foreach( yb; ys[ yi .. $ ] )
				{
					auto c = 0L;
					foreach( xy; xys )
					{
						c += ( xa <= xy[ 0 ] && xy[ 0 ] <= xb && ya <= xy[ 1 ] && xy[ 1 ] <= yb );
						if( c == k )
						{
							ans = min( ans, ( xb - xa ) * ( yb - ya ) );
							break;
						}
					}
				}
			}
		}
	}
	return ans;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ui = unsigned int;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807;


//AtCoder Regular Contest 067-D
int main() {
	ll N;
	scanf("%lld", &N);
	ll A;
	scanf("%lld", &A);
	ll B;
	scanf("%lld", &B);

	vector<ll> X(N);
	for (ll i = 0; i < N; i++) {
		scanf("%lld", &X[i]);
	}

	ll result = 0;

	for (ll i = 0; i < N - 1; i++) {
		ll dist = X[i + 1] - X[i];
		result += min(A * dist, B);
	}

	printf("%lld\n", result);
}


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

constexpr size_t print_limit = 10;

template <typename It>
void print(ostream& os, It begin, It end, size_t len) {
    size_t count = 0;
    os << "{";
    while (begin != end && count < print_limit) {
        os << "(" << *begin << ")";
        count++;
        begin++;
    }
    if (print != end)
        os << "... " << len << " total";
    os << "}";
}

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& t) {
    print(os, t.begin(), t.end(), t.size());
    return os;
}


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

    size_t n;
    cin >> n;
    size_t segm = 0, res = 0;
    for (size_t i = 1; i <= n; i++) {
        size_t a;
        cin >> a;
        if (a == i) {
            segm++;
        }
        else {
            res += (segm + 1) / 2;
            segm = 0;
        }
    }
    res += (segm + 1) / 2;
    cout << res << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
S = {"A","B"}
s1 = {s[0],s[1]}
s2 = {s[2],s[1]}
if s1 == S or s2 == S:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 38256
#!/usr/bin/env python3

X, Y = list(map(int, input().split()))
is_ok = False
for i in range(0, X + 1):
    if (i * 2 + (X - i) * 4) == Y:
        is_ok = True
        break
ans = "Yes" if is_ok else "No"
print(ans)


Measured memory_bytes: 9152