akhauriyash/Code-Regression huggingface dataset:
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

std::vector<int> dp1(110);
std::vector<int> dp2(110);

int main(){
	
	int n;
	cin>>n;
	int a[n];
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}


	for(int i=1;i<=n;i++){
		dp1[i] = dp1[i-1]+a[i]; 
	}

	for(int i=n;i>=1;i--){
		dp2[i] = dp2[i+1]+a[i]; 
	}
	int mx = 1000;
	for(int i=1;i<n;i++){
		mx = min(mx,abs(dp1[i] - dp2[i+1]));
	}


	cout<<mx<<endl;


	

	return 0;
}

Measured memory_bytes: 3632
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

import Debug.Trace

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ i, o, _, j, l, _, _ ] :: [ Integer ] <- map read . words <$> getLine
	print $ o + solve i j l

solve a b c
	| 0 < mi = max ( mi * 3 + solve' ( a - mi ) ( b - mi ) ( c - mi ) ) ( ( mi - 1 ) * 3 + solve' ( a - mi + 1 ) ( b - mi + 1 ) ( c - mi + 1 ) )
	| otherwise = solve' a b c
	where
		mi = minimum [ a, b, c ]
		d = ( * 2 ) . ( `div` 2 )
		solve' a b c = d a + d b + d c

Measured memory_bytes: 508
# coding:utf-8

import sys
import math
import time
import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength


#X = str(input()).split()
N = int(input())
P = str(input()).split()
PP = []
# S = [[0 for i in range(W)] for j in range(H)]
val = 0

for i in range(N):
  PP.append(int(P[i]))

MIN = PP[0]

for i in range(N):
  #print(max(PP[:i+1]))
  #print(PP[i])
  MIN = min(MIN, PP[i])
  if(MIN>=PP[i]):
    val += 1

print(val)



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

int main() {
  
  int N,K,X,Y;
  cin >> N >> K >> X >> Y;
  
  if (N<K){
    cout << N*X << endl;
  }
  else{
    cout << K*X+(N-K)*Y << endl;
  }
}

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

int W, H, N;
int x[100], y[100], a[100];

int main() {
    cin >> W >> H >> N;
    rep(i, N) cin >> x[i] >> y[i] >> a[i];

    int x_min = 0;
    int x_max = W; 
    int y_min = 0;
    int y_max = H;

    rep(i, N) {
        switch (a[i]) {
        case 1:
            x_min = max(x[i], x_min);
            x_min = min(x_max, x_min);
            break;
        case 2:
            x_max = min(x[i], x_max);
            x_max = max(x_max, x_min);
            break;
        case 3:
            y_min = max(y[i], y_min);
            break;
        case 4:
            y_max = min(y[i], y_max);
            break;
        default:
            break;
        }
    }

    // printf("x_min: %d x_max: %d y_min: %d y_max: %d\n", x_min, x_max, y_min, y_max);
    cout << max(0, (x_max - x_min) * (y_max - y_min)) << endl;
}

Measured memory_bytes: 256
#https://atcoder.jp/contests/abc154/tasks/abc154_e

def oneNum(N):
    answer = 0

    while(N > 0):
        if(N >= 9):
            answer = answer + 9
        else:
            answer = answer + N
        
        N = N // 10

    return answer

def twoNum(N):
    answer = 0

    strN = str(N)
    topN = int(strN[0])
    lenN = len(strN)

    if(lenN != 1):
        answer = answer + oneNum(int(strN[1:])) + (topN - 1) * oneNum(int('9' * (lenN - 1)))
        N = int('9' * (lenN - 1))

    while(N >= 10):
        N = N // 10
        answer = answer + 9 * oneNum(N)

    return answer

def main():
    N = int(input())
    K = int(input())

    answer = 0

    if(K == 1):
        answer = oneNum(N)

    elif(K == 2):
        answer = twoNum(N)

    else:
        strN = str(N)
        topN = int(strN[0])
        lenN = len(strN)

        answer = answer + twoNum(int(strN[1:])) + (topN - 1) * twoNum(int('9' * (lenN - 1)))

        N = int('9' * (lenN - 1))

        while(N >= 100):
            N = N // 10
            answer = answer + 9 * twoNum(N)

    print(answer)

if __name__ == "__main__":
    main()

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


int main()
{
	string S;


	cin >> S;
	
	//計算パート
	if ((S[0] != S[1]) && (S[1] != S[2]) && (S[2] != S[0]))
	{
		cout << "Yes\n";
	}
	else
	{
		cout << "No\n";
	}

	
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
 string str,ptr; cin>>str>>ptr; int n=str.length(),c=0;
 for(int i=0;i<n;i++){
    if(str[i]==ptr[i])c++;
 } if(c==n)cout<<"Yes"; else cout<<"No";
}




Measured memory_bytes: 3604
# coding: utf-8
# Your code here!
import math

X = int(input())

for i in range(X, 0, -1):
    for j in range(math.floor(math.sqrt(X)), 0, -1):
        for k in range(10):
            if pow(j, k) == i:
                print(pow(j, k))
                exit()

Measured memory_bytes: 39792
#include <iostream>
#include <math.h>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;
#define n_max 1000

int main()
{
    int N, n, ans = 0;

    cin >> N;

    for(int i = 0; i <= 25; i++) {
        for(int j = 0; j <= 14; j++) {
            n = i * 4 + j * 7;
            if(n == N) { ans++; }
        }
    }
    
    if(ans) { 
        puts("Yes");
    } else {
        puts("No");
    }

    return 0;
}


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

#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define bk back
#define ed endl
#define en cout << endl
#define wl while
#define mod 1000000007
#define f(i, a, b) for(ll i = a; i < b; i++)
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
const int INF = 1e9 + 5;

using namespace std;

int main()
{
    FAST;
    int n, k; cin >> n >> k;
    vector<int> h;
    for(int i = 0; i < n; i++)
    {
        int val;
        cin >> val;
        h.pb(val);
    }
    vector<int> dp(n, INF);
    dp[0] = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = i + 1; j < n && j <= i + k; j++)
        {
            if(j < n)
            {
                dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
            }
        }

    }

    cout << dp[n - 1] << ed;

    return 0;
}


Measured memory_bytes: 1144
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
 

#define int             long long

 
void anmol()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
 
const int N = 1e6 + 5 ;
 int a[N], b[N] , freq[N];

 

int32_t main(){

  anmol();
  string s;
  cin>>s;

  string t;
  cin>>t;
 
  int n = s.length();
  int m = t.length();

  int z = min(n,m);
  int count =0;

  for(int i =0; i<z; i++){

      if(s[i]!=t[i]){

        count++;
      }



  }
  
  count +=max(n,m)-z;
  cout<<count<<endl;
  


   }




  
 






   

  
  

   
   





  










 
 





  



 
 
    

  
 
 
 
 
 


 

   

 
 



  
  












 
 





  



 
 
    

  































 
 



  
  












 
 





  



 
 
    

  
 
 
 
 
 


 

   

 
 



  
  












 
 





  



 
 
    

  


Measured memory_bytes: 3808
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;



// エラストテネスの篩
const int N = 1e7+1;
bool is_prime[N];
void build_sieve(){
    fill(is_prime, is_prime + N, true);
    is_prime[0] = is_prime[1] = false;
    for(int i = 2; i < N; ++i)if(is_prime[i]){
        for(int j = 2*i; j < N; j+=i)is_prime[j] = false;
    }
}

void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<typename T>
void print(T &arr){
    ll sz = sizeof(arr)/sizeof(arr[0]);
    for(int i = 0;i < sz-1;i++){cout << arr[i] << ' ';}
    cout << arr[sz-1] << endl;
}

int main(){
    ll q; cin >> q;
    ll n = 1e5+10;
    vector<vector<ll>> lr(q,vector<ll>(2,0));
    rep(i,q){
        cin >> lr[i][0] >> lr[i][1];
    }
    build_sieve();
    vector<ll> sum(n+1,0);
    rep(i,n){
        if(i%2 == 0)sum[i+1] = sum[i];
        else{
            if(is_prime[i] && is_prime[(i+1)/2]){
                sum[i+1] = sum[i] + 1;
            }
            else sum[i+1] = sum[i];
        }
    }

    // rep(i,20){
    //     print(i,sum[i]);
    // }
    rep(i,q){
        cout << sum[lr[i][1]+1] - sum[lr[i][0]] << endl;
    }

}

Measured memory_bytes: 16640
#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <cstring>
#include <string.h>
#include <sstream>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using vec = vector<T>;
template<typename T> using prior = priority_queue<T>;;

const ll MOD = 1e9+7;
const ll SPMOD = 998244353;
const double PI  = 3.14159265358;
const double EPS = 1e-8;
 
#define INT_MX 2147483647
#define INF ((int)1e9)
#define LLINF ((ll)1e18)
#define F first
#define S second
#define MP(x,y) make_pair(x,y)
#define siz(v) ((int)v.size())
#define rs(n) resize(n)
#define ALL(v) v.begin(),v.end()
#define reset(v) memset((v),0,sizeof(v))
#define Unique(v) v.rs(unique(ALL(v))-v.begin())
#define EB emplace_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,a,b) for(int i=(a);i<=(b);i++)
#define __ <<' '<<
#define kiyohime ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

// template
ll POW();
int gcd(int a, int b);
// end of template

#define N 100010

void solve(){
    int a[3][3], n, ipt;
    
    rep(i, 3) rep(j, 3)
        cin >> a[i][j] ;
    
    cin >> n;
    while(n--){
        cin >> ipt;
        rep(i, 3) rep(j, 3)
            if(a[i][j] == ipt)
                a[i][j] = -1;
    }
    
    bool flag, suc = false;
    
    rep(i, 3){
        flag = true;
        rep(j, 3)
            if(a[i][j] != -1)
                flag = false;
        suc |= flag; // boolean operator "or"
        
        flag = true;
        rep(j, 3)
            if(a[j][i] != -1)
                flag = false;
        suc |= flag;
    }
    
    flag = true;
    rep(i, 3){
        if(a[i][i] != -1)
            flag = false;
    }
    suc |= flag;
    
    flag = true;
    rep(i, 3){
        if(a[i][2-i] != -1)
            flag = false;
    }
    suc |= flag;
    
    if(suc) cout << "Yes" << '\n';
    else    cout << "No " << '\n';
}

int main(){
    kiyohime
    int T = 1;
    
    while(T--){
        solve();
    }
}


// templates

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

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


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

typedef long long ll;

typedef pair<ll,ll> P;

const ll mod = 998244353;

ll n;
vector<P> xd;
vector<P> num;
ll ans = 1;
vector<ll> X;
vector<ll> D;
bool use[200005];
vector<int> g[200005];

ll dfs(int v,int prev) {

  ll res = 1;
  
  for(int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if(u == prev) continue;
    res = res * (dfs(u,v) + 1) % mod;
  }


  return res;
}

int main() {
  cin >> n;
  for(int i = 0; i < n; i++) {
    ll x,d;
    cin >> x >> d;
    xd.push_back(P(x,d));
  }
  sort(xd.begin(),xd.end());

  set<P> s;
  for(int i = n - 1; i >= 0; i--) {
    ll x = xd[i].first, d = xd[i].second;
    while(!s.empty() && s.begin()->first < x+d) {
      g[i].push_back(s.begin()->second);
      s.erase(s.begin());
    }
    s.insert(P(x,i));
  }

  while(!s.empty()) {
    ans = ans * (dfs(s.begin()->second,-1) + 1) % mod;
    s.erase(s.begin());
  }
  cout << ans << endl;

  /* for(int i = 0; i < n; i++) {
    for(int j = 0; j < g[i].size(); j++) {
      cout << g[i][j];
    }
    cout << endl;
    }*/
  
}
    
  
  



Measured memory_bytes: 30700
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

class Edge
{
public:
    int to, cost, time, company;
    Edge(int to0, int cost0, int time0, int company0){
        to = to0;
        cost = cost0;
        time = time0;
        company = company0;
    }
};

const int INF = INT_MAX / 2;

int main()
{
    for(;;){
        int n, e, h, m;
        cin >> n >> e >> h >> m;
        if(n == 0)
            return 0;

        vector<vector<Edge> > edges(n+1);
        for(int i=0; i<e; ++i){
            int a, b, c, h, r;
            cin >> a >> b >> c >> h >> r;
            edges[a].push_back(Edge(b, c, h, r-1));
            edges[b].push_back(Edge(a, c, h, r-1));
        }

        int s, t, p;
        cin >> s >> t >> p;

        vector<pair<int, int> > passport(p);
        for(int i=0; i<p; ++i){
            int l, d;
            cin >> l >> d;
            int x = 0;
            for(int j=0; j<l; ++j){
                int k;
                cin >> k;
                x |= 1 << (k - 1);
            }
            passport[i] = make_pair(x, d);
        }

        vector<int> somePassport(1<<m, INF);
        somePassport[0] = 0;
        for(int i=0; i<(1<<m); ++i){
            for(int j=0; j<p; ++j){
                int k = i | passport[j].first;
                somePassport[k] = min(somePassport[k], somePassport[i] + passport[j].second);
            }
        }

        int ans = INF;
        for(int i=0; i<(1<<m); ++i){
            vector<vector<int> > dp(h+1, vector<int>(n+1, INF));
            multimap<int, pair<int, int> > mm;
            dp[0][s] = somePassport[i];
            mm.insert(make_pair(somePassport[i], make_pair(0, s)));
            while(!mm.empty()){
                int cost = mm.begin()->first;
                int time = mm.begin()->second.first;
                int pos  = mm.begin()->second.second;
                mm.erase(mm.begin());
                if(dp[time][pos] < cost)
                    continue;

                for(const Edge& e : edges[pos]){
                    int cost2 = cost;
                    int time2 = time + e.time;
                    int pos2 = e.to;
                    if(!(i & (1 << e.company)))
                        cost2 += e.cost;

                    if(time2 <= h && cost2 < dp[time2][pos2]){
                        dp[time2][pos2] = cost2;
                        mm.insert(make_pair(cost2, make_pair(time2, pos2)));
                    }
                }
            }

            for(int j=0; j<=h; ++j)
                ans = min(ans, dp[j][t]);
        }

        if(ans < INF)
            cout << ans << endl;
        else
            cout << -1 << endl;
    }
}

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

using namespace std;
pair<long long, long long> a[100001];
int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n, m; cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i].first >> a[i].second;
	}
	long long sum = 0;
	sort(a, a + n);
	for (int i = 0; i < n; i++) {
		if (a[i].second <= m) {
			sum += a[i].first * a[i].second;
			m -= a[i].second;
		}
		else {
			sum += a[i].first * m; break;
		}
	}

	cout << sum << '\n';





}

Measured memory_bytes: 1792
n = int(input())
A = list(map(int, input().split()))
fw = [a for i,a in enumerate(A) if i%2 == 0]
bw = [a for i,a in enumerate(A) if i%2 == 1]
if len(A) % 2 == 0:
  ans = list(reversed(bw)) + fw
else:
  ans = list(reversed(fw)) + bw
print(' '.join([str(a) for a in ans]))

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

unsigned long long f(unsigned long long n, unsigned long long k)
{
    if (n > k)
    {
        unsigned long long diff = n - k;
        n -= (diff / k) * k;
        if (n > k)
        {
            n = min(n, n - k);
        }
    }
    else if (n == k)
    {
        n = 0;
    }
    else
    {
        n = k - n;
    }
    return n;
}

int main()
{
    unsigned long long N, K;
    cin >> N >> K;
    unsigned long long ans = N;
    for (int i = 0; i < 100000; i++)
    {
        N = f(N, K);
        ans = min(ans, N);
    }
    cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> pi;
typedef pair<int,int> vi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i <= b; i++)


int main() {
	string a, b;
	cin >> a >> b;
	
	a = a+b;
	int sol = stoi(a);
	string answer = "No";
	for(int i = 1; i <= 1000; i++){
		if(i * i == sol){
			answer = "Yes";
			break;
		}
	}
	cout << answer << "\n";
			
}


Measured memory_bytes: 256
#include <cstdio>
#include <queue>

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  queue< int >  q, tq;
  int n, m;
  int i;

  scanf ( "%d%d", &n, &m );
  for ( i = 1; i <= ( n << 1 ); ++i )
  {
    q.push ( i );
  }

  while ( m-- )
  {
    int opr;

    scanf ( "%d", &opr );
    if ( opr )
    {
      for ( i = 0; i < opr; ++i )
      {
        int t = q.front ( );
        q.pop ( );
        q.push ( t );
      }
    }
    else
    {
      for ( i = 0; i < n; ++i )
      {
        int t = q.front ( );
        q.pop ( );
        tq.push ( t );
      }
      for ( i = 0; i < ( n << 1 ); ++i )
      {
        int t;
        if ( i & 0x01 )
        {
          t = q.front ( );  q.pop ( );
        }
        else
        {
          t = tq.front ( ); tq.pop ( );
        }
        q.push ( t );
      }
    }
  }

  for ( i = 0; i < ( n << 1 ); ++i )
  {
    printf ( "%d\n", q.front ( ) );
    q.pop ( );
  }

  return ( 0 );
}

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

int main(){
  int d;
  int c[27];
  int s[400][27];
  int t[400];
  static int last[27];//最後の開催日
  int ans = 0;

  cin >> d;
  rep(i, 26)cin >> c[i+1];
  rep(i, d){
    rep(j, 26){
      cin >> s[i+1][j+1];
    }
  }

  for(int i=1;i<=d;i++){
    int mx = -INF;
    int mxi;
    for(int j=1;j<=26;j++){
      int tmp=0;
      tmp += s[i][j];
      for(int k=1;k<=26;k++){
        if(j!=k)tmp-=(i-last[k])*c[k];
      }
      if(tmp>mx){
        mx = tmp;
        mxi = j; 
      }
    }
    t[i]=mxi;
    last[t[i]]=i;
  }

  rep(i, d)cout << t[i+1] << endl;
  return 0;
}


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

using namespace std;


int main()
{
  ios::sync_with_stdio(0);

  int n;
  string s,t;

  cin>>n;
  cin>>s>>t;

  for(int i=0;i<n;i++)
  {

      cout<<s[i]<<t[i];
  }

   cout<<endl;

return 0;   }



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

int main(){
  int N;
  char S[4000];
  long long int count = 0;
  long long int r, g, b;
  r = 0; g = 0; b = 0;
  long long int set, ans;

  cin >> N;
  cin >> S;

  for (int i = 0; i < N; i++){
    if (S[i] == 'R'){
      r++;
    }
  }

  for (int i = 0; i < N; i++){
    if (S[i] == 'G'){
      g++;
    }
  }

  for (int i = 0; i < N; i++){
    if (S[i] == 'B'){
      b++;
    }
  }

  set = r * g * b;

  for (int i = 0; i < N; i++){
    for (int j = i + 1; j < N; j++){
      long long int k = j * 2 - i;
      if ((S[i] != S[j]) && (S[i] != S[k]) && (S[j] != S[k]) && k < N){
        count++;
      }
    }
  }

  ans = set - count;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define mp make_pair
using namespace std;
ll gcd(ll x,ll y){
	if(x*y==0)return x+y;
	else if(x>y){ return gcd(y,x%y);}
	else return gcd(x,y%x);
}
int main(){
	ll n,m;
	cin>>n>>m;
	string s,t;
	cin>>s>>t;
	ll g = gcd(m,n);
	ll l = m*n/g;
	ll cn = l/n;
	ll cm = l/m;
	for(int i=0;i<n;i++){
		ll cur = cn*i;
		if(cur%cm==0){
			if(s[i]!=t[cur/cm]){
				cout<<-1<<endl;
				return 0;
			}
		}
	}
	cout<<l<<endl;
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(int i=(a),_ed=(b);i<=_ed;++i)
#define DREP(i,a,b) for(int i=(a),_ed=(b);i>=_ed;--i)
#define mp(x,y) make_pair((x),(y))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int,int> pii;
inline int read(){
    register int x=0,f=1;register char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=0;ch=getchar();}
    while(isdigit(ch)){x=x*10+(ch^'0');ch=getchar();}
    return f?x:-x;
}

int n;
ll f[100005][3];
inline void chkmax(ll& x,ll y){x=x>y?x:y;}

int main(){
	// freopen("in.in","r",stdin);
	f[0][0]=0,f[0][1]=f[0][2]=-1e16;
	n=read();
	REP(i,1,n){
		int x=read();
		f[i][0]=max(f[i-1][0],f[i-1][1]);
		f[i][1]=max(f[i-1][1],f[i-1][2]);
		f[i][2]=f[i-1][2];
		f[i][0]+=x,f[i][1]-=x,f[i][2]+=x;
		if(x<0)chkmax(f[i][2],f[i][1]),chkmax(f[i][1],f[i][0]);
	}
	printf("%lld\n",max(f[n][0],max(f[n][1],f[n][2])));
	return 0;
}


Measured memory_bytes: 2560
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

fn main(){

    input!{
        n: usize,
        h: [usize;n],
    }

    let mut dp: Vec<bool> = vec![false;n];

    for i in 0..n-1 {
        if h[i] >= h[i+1] {
            dp[i] = true;
        }
    }

    let mut cnt = 0;
    let mut ans = 0;
    for i in 0..n-1 {
        if dp[i] == true {
            cnt += 1;
        } else {
            cnt = 0;
        }
        ans = std::cmp::max(ans, cnt);
    }

    println!("{}", ans);

}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    ll n, k;
    cin >> n >> k;
    double ans = 0;
    REP(i,1,n+1){
        double tmp = 1.0/n;
        ll now = i;
        while(now < k){
            now *= 2;
            tmp /= 2;
        }
        ans += tmp;
    }
    printf("%.10f\n",ans);
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000
#define LLINF 1e18

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

void solve_abc_a() {
	ll n, m;
	ll x, y;
	ll a, b, d;
	ll c;
	//char c;
	ll h, w;
	ll k;
	string s, t;
	//ll s, t;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> s;

	if (s[s.size() - 1] == 's') {
		s += "es";
	}
	else {
		s += "s";
	}

	cout << s << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}


Measured memory_bytes: 3636
/* ****_hela**** */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		string s;
		cin>>s;
		int flg=0;
		rep(i,0,s.size())
		{
			if(s[i]=='7')flg=1;
		}		
		if(flg)cout<<"Yes";
		else cout<<"No";
	}
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  if(a>=13){
    cout << b << endl;
  }
   if(0<=a && a<=5){
    cout << 0 << endl;
  }  
  if(6<=a&& a<=12){
    cout << b/2 << endl;
  }
}
    

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

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define lrep(i,n) for(long long  i = 0; i < (long long)(n); i++)
#define lrep2(i,a,n) for(long long i = (long long)(a); i <= (long long)(n); i++)

#define irrep(i,n) for(int i = (int)(n); i > -1; i--)
#define irrep2(i,a,n) for(int i = (int)(n); i >= (int)(a); i--)

typedef long long ll;
typedef std::vector<char> v_char;
typedef std::vector<v_char > v2_char;
typedef std::vector<double> v_double;
typedef std::vector<v_double > v2_double;
typedef std::vector<int> v_int;
typedef std::vector<v_int > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<v_ll > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<v_string > v2_string;
typedef std::vector<bool> v_bool;
typedef std::vector<v_bool > v2_bool;
typedef std::pair<ll, ll> pll;
typedef std::pair<int, int> pii;

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

using namespace std; 

int main(void)
{
    int a, b;
    cin >> a >> b;
    
    if(a+b < 10) { 
        cout << a+b;
    } else {
        cout << "error";
    }
    
    return 0;
}   
/** atcoder **/


Measured memory_bytes: 256
import sys
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
mod = 10**9 + 7
inf = float('inf')
A,B = LI()
ans = int(0)

if 1<=A<=9 and 1<=B<=9:
    ans = A*B
    print(ans)
else:
    print("-1")


Measured memory_bytes: 3060
using System;
using System.Linq;

namespace ABC176
{
    class Program
    {
        static void Main(string[] args)
        {
            a();
        }

        public static void a()
        {
            int[] nxt = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = nxt[0], x = nxt[1], t = nxt[2];
            int ans = 0;
            ans = n / x;
            ans *= t;
            n %= x;
            if (n != 0)
                ans += t;
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 28200
#include<stdio.h>
int main(void)
{
	int a,b,c;
	int i =0;
	scanf("%d %d %d",&a,&b,&c);
	 for (a = a; a <= b; a++) {
	 	if(c % a == 0){
	 	i++;
	 	}
	 }
	 	printf("%d\n",i);
	return 0;
}

Measured memory_bytes: 596
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define eps 1e-18
#define maxn 100010
inline ll read(){ll tmp=0; char c=getchar(),f=1; for(;c<'0'||'9'<c;c=getchar())if(c=='-')f=-1; for(;'0'<=c&&c<='9';c=getchar())tmp=(tmp<<3)+(tmp<<1)+c-'0'; return tmp*f;}
inline ll power(ll a,ll b){ll ans=1; for(;b;b>>=1){if(b&1)ans=ans*a%mod; a=a*a%mod;} return ans;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void swap(int &a,int &b){int tmp=a; a=b; b=tmp;}
using namespace std;
map<string,int>a;
string s[110];
int n;
int main()
{
	n=read();
	cin>>s[1]; a[s[1]]=1;
	for(int i=2;i<=n;i++){
		cin>>s[i];
		if(a[s[i]]||*s[i].begin()!=*(s[i-1].end()-1)){
			printf("No\n"); return 0;
		}
		a[s[i]]=i;
	}
	printf("Yes\n");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <vector>
#include <climits>
#include <queue>
#include <utility>
#include <iomanip>
#include <sstream> 
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
template<typename T1, typename T2>
inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2>
inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
const ll MOD = 1000000006;
const ll INF = 1LL << 60;

vector<ll> a;

int main()
{
    ll l, r, d;
    cin >> l >> r >> d;
    
    ll ans = 0;

    for (int i = l; i <= r; i++) {
        if (i % d == 0)
            ans++;
    }
    

    

    cout << ans;


}

Measured memory_bytes: 3620
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
temperatures = []
for i in range(N):
    temperatures.append(T - H[i] * 0.006)
# print(temperatures)
diff = 10**9
ans = -1
for i in range(N):
    new_diff = abs(temperatures[i] - A)
    if diff > new_diff:
        diff = new_diff
        ans = i

print(ans+1)


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

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            string[] input1 = Console.ReadLine().Split(' ');
            int s = int.Parse(input1[0]);
            int w = int.Parse(input1[1]);

            if(w >= s)
            {
                Console.WriteLine("unsafe");
            }
            else
            {
                Console.WriteLine("safe");
            }
        }
    }
}

Measured memory_bytes: 27496
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <map>
#include <vector>

#define div 1000000000+7

typedef long long ll;

using namespace std;

void solve() {
    int x, y;
    int a[] = {1, 3, 5, 7, 8, 10, 12}, b[] = {4, 6, 9, 11};
    cin >> x >> y;
    for (int i = 0; i < 7; i++) {
        if (x == a[i]) {
            for (int j = i; j < 7; j++) {
                if (y == a[j]) {
                    cout << "Yes" << endl;
                    return;
                }
            }
        }
    }
    for (int i = 0; i < 4; i++) {
        if (x == b[i]) {
            for (int j = i; j < 4; j++) {
                if (y == b[j]) {
                    cout << "Yes" << endl;
                    return;
                }
            }
        }
    }
    cout << "No" << endl;
}

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


Measured memory_bytes: 256
import numpy as np

N, M = [int(x) for x in input().split()]
A=[]
B=[]
for i in range(N):
    A.append(list(input()))
for j in range(M):
    B.append(list(input()))
A = np.array(A)
B = np.array(B)
for i in range(N-M+1):
    for j in range(N-M+1):
        A_ = A[i:(i+M),j:(j+M)]
        if np.array_equal(A_,B):
            print('Yes')
            exit()

print('No')


Measured memory_bytes: 14032
A,B=map(int,input().split())
if A==B:
    print(A+B)
elif A>=B:
    if A-1>=B:
        print(A+A-1)
    elif A-1==B:
        print(A+A-1)
    elif A-1<=B:
        print(A+B)
else:
    if B-1>=A:
        print(B+B-1)
    elif B-1==A:
        print(B+B-1)
    elif B-1<=A:
        print(B+A)
    


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0;i<(n);++i)
const int MOD = 1e9+7;

int H, W;
int main() {
  in(H); in(W);

  vector<vector<int>> dp(H+1, vector<int>(W+1, 0));
  dp[0][0] = 1;
  rep(i, H) rep(j, W) {
    char a; cin >> a;
    if (a == '#')
      continue;
    (dp[i+1][j] += dp[i][j]) %= MOD;
    (dp[i][j+1] += dp[i][j]) %= MOD;
  }

  cout << dp[H-1][W-1] << endl;
  return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    VI b(n - 1), a(n);
    FOR(i, 0, n - 1)cin >> b[i];

    a[0] = b[0];
    FOR(i, 1, n - 1) {
        a[i] = min(b[i - 1], b[i]);
    }
    a[n - 1] = b[n - 2];
    ll ans = 0;
    for (ll i : a)ans += i;
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
static const int M = 1046527;
static const int L = 14;
char H[M][L];

int getChar(char ch){
    if (ch == 'A') return 1;
    else if (ch == 'C') return 2;
    else if (ch == 'G') return 3;
    else if (ch == 'T') return 4;
    else return 0;
}

long long getKey(char str[]){
    long long sum = 0, p = 1, i;
    for (i =0;i<strlen(str);i++){
        sum += p*(getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return  key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]){
    long long key, i, h;
    key = getKey(str);
    for (i=0;;i++){
        h = (h1(key)+i*h2(key)) % M;
        if(strcmp(H[h],str)==0) return 1;
        else if (strlen(H[h])==0) return 0;
    }
    return 0;
}

int insert(char str[]){
    long long key, i, h;
    key = getKey(str);
    for(i=0;;i++){
        h=(h1(key)+i*h2(key))%M;
        if (strcmp(H[h],str)==0) return 1;
        else if(strlen(H[h])==0){
            strcpy(H[h],str);
            return 0;
        }
    } 
}

int main(){
    int i, n, h;
    char str[L],com[9];
    for(i=0;i<M;i++) H[i][0] = '\0';
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s %s", com, str);
        if(com[0]=='i'){
            insert(str);
        }else{
            if(find(str)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
    return 0;
}


Measured memory_bytes: 17468
//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
    



int main(){
   IOS
   
    int a; cin>>a;
    cout<<(a + a*a + a*a*a)<<"\n";





}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
    if(b&1) res = res * a % mod;
        a = a * a % mod;
    b >>= 1;
    }

    return res;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
long long ans, tmp, digit;
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int M;
    cin >> M;
    vector<pair<int, long long> > DC(M);
    for (auto &dc : DC) {
        cin >> dc.first >> dc.second;
        digit += dc.second;
        tmp += dc.second*dc.first;
    }
    ans = (tmp-1)/9+digit-1;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 3328
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!T;r.popFront;}}

void main()
{
  int n, z, w; readV(n, z, w);
  int[] a; readA(n, a);

  if (n == 1)
    writeln((a[$-1]-w).abs);
  else
    writeln(max((a[$-1]-w).abs, (a[$-2]-a[$-1]).abs));
}


Measured memory_bytes: 2300
program Vacation
    implicit none
    integer(4):: n, i,j,k
    integer(4), allocatable:: a(:), b(:), c(:), dp(:,:)

    read*, n
    allocate(a(n), b(n), c(n), dp(3,0:n))
    do i=1,n
        read*, a(i), b(i), c(i)
    end do
    dp(:,:) = 0


    do i=1, n
        dp(1,i) = max(dp(2,i-1),dp(3,i-1))+a(i)
        dp(2,i) = max(dp(1,i-1),dp(3,i-1))+b(i)
        dp(3,i) = max(dp(1,i-1),dp(2,i-1))+c(i)
    end do
    print*, maxval(dp(:,n))
end program Vacation

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int n;
int cnt = 0;

bool check(ll x) {
  if (x > n) return false;

  string s = to_string(x);
  bool c3 = false, c5 = false, c7 = false;
  for (int i = 0; i < s.size(); i++) {
    if (s.at(i) == '3') c3 = true;
    if (s.at(i) == '5') c5 = true;
    if (s.at(i) == '7') c7 = true;
  }

  if (c3 && c5 && c7)
  return true;
  else
  return false;
}

void dfs(ll x) {
  if (check(x)) cnt++;
  if (x <= 1000000000) {
    dfs(10 * x + 3);  // long long必要
    dfs(10 * x + 5);
    dfs(10 * x + 7);
  }
}

int main() {
  cin >> n;
  dfs(0);
  cout << cnt << endl;
}

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

int main()
{
    int a, b, c;
    std::cin >> a >> b >> c;
    if (b - a == c - b) { std::cout << "YES" << std::endl; }
    else
    {
        std::cout << "NO" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>
#include <stdio.h>

using namespace std;

int numOfPie(int N, int P){
    return (N*3+P)/2;
}


int main(void){
  int N,P;

  scanf("%d%d", &N, &P);
  std::cout << numOfPie(N,P) << std::endl;
  return 0;
}

Measured memory_bytes: 256
import copy

n, m = [int(i) for i in input().split()]
ans = []
a = list(map(int, input().split()))
for i in range(len(a)):
    ans.append([1, a[i]])
for i in range(m):
    d, e = [int(i) for i in input().split()]
    ans.append([d, e])

ans1 = sorted(ans, key=lambda x: x[1], reverse = True)
cnt = 0
ans2 = 0
k = 0
while cnt < n:
    ans2 += ans1[k][0] * ans1[k][1]
    cnt += ans1[k][0]
    k += 1
ans2 -= (cnt - n) * ans1[k-1][1]
print(ans2)

Measured memory_bytes: 39860
/*
    Washief Hossain Mugdho
    19 September 2020
    Educational DP Deque
*/

#ifndef DEBUG
#pragma GCC optimize("O3")
#endif

#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define fastio ios_base::sync_with_stdio(0)
#define untie cin.tie(0)
#define ms(a, b) memset(a, b, sizeof a)
using namespace std;
ll a[3004];
ll memo[3004][3004];

ll dp(int x, int y)
{
    if (x > y)
        return 0;
    if (x == y)
        return a[x];
    if (memo[x][y])
        return memo[x][y];

    ll p = a[x] - dp(x + 1, y);
    ll q = a[y] - dp(x, y - 1);
    return memo[x][y] = max(p, q);
}

int main()
{
#ifdef LOCAL_OUTPUT
    freopen(LOCAL_OUTPUT, "w", stdout);
#endif
#ifdef LOCAL_INPUT
    freopen(LOCAL_INPUT, "r", stdin);
#endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];

    cout << dp(1, n) << endl;
}


Measured memory_bytes: 49988
#include <cstdio>
#include <algorithm>
using namespace std;
int ar[105];

bool cmp(int a,int b)
{
    return a>b;
}
int main()
{
    int n;
    while(~scanf("%d",&n)){
        for(int i=0;i<n;i++)
            scanf("%d",&ar[i]);
        sort(ar,ar+n,cmp);
        int ali,bob;
        ali = bob = 0;
        int flag=0;
        for(int i = 0;i<n;i++){
            if(flag == 0)
                ali += ar[i];
            else
                bob += ar[i];
            flag = !flag;
        }
        printf("%d\n",ali-bob);
    }
    return 0;
}


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

using namespace std;

int A[100020],B[100020],C[100020];
long long cnt1[100020],cnt2[100020];

int main()
{
   int N;
   cin>>N;
   for(int i=0;i!=N;++i) cin>>A[i];
   for(int i=0;i!=N;++i) cin>>B[i];
   for(int i=0;i!=N;++i) cin>>C[i];
   memset(cnt1,0,sizeof(cnt1));
   memset(cnt2,0,sizeof(cnt2));
   sort(A,A+N);
   sort(B,B+N);
   sort(C,C+N);
   for(int i=0;i!=N;++i){
    cnt1[upper_bound(B,B+N,A[i])-B]++;
   }
   for(int i=1;i!=N;++i){
        cnt1[i]+=cnt1[i-1];
   }
   for(int i=0;i!=N;++i){
    cnt2[upper_bound(C,C+N,B[i])-C]+=cnt1[i];
   }
   long long ans =0;
   for(int i=1;i!=N;++i){
        cnt2[i]+=cnt2[i-1];
   }
   for(int i=0;i!=N;++i){
       ans +=cnt2[i];
   }
   cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <string>


using std::cout;
using std::cin;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;


void oneCase () {
   ll l, r, k;
   cin >> l >> r >> k;
   auto dl = min(l, k);
   l -= dl;
   k -= dl;
   auto dr = min(r, k);
   r -= dr;
   cout << l << " " << r;

}




int main() {
    int k = 1;
//    cin >> k;
    for (int i = 0; i < k; ++i) {
        oneCase();
    }

    return 0;
}

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

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

	int N, flg = 0, ans = 0;
	string S;
	cin >> N >> S;

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

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
 
#define INF (long long)1000000000
#define MOD 1000000007
#define EPS 1e-8
 
#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back
 
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
 
__int128 gcd(__int128 a, __int128 b) {		// ユークリッドの互除法
	if (b == 0) return a;
	return gcd(b, a % b);
}
 
int main() {
	int n;
	cin>>n;
	vector<ll> t(n);
	REP(i,n) cin>>t[i];
	vector<__int128> ta(n);
	REP(i,n) ta[i]=t[i];
	__int128 res = 1;
	REP(i,n) {
		res=res*t[i]/gcd(res,t[i]);
	}
	ll ans = res;
	cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <stdio.h>
#define MAX 100000

typedef struct{
  char name[10];
  int time;
} Queue;

void initialize(void);
void enqueue(Queue);
Queue dequeue(void);
int isEmpty(void);
int isFull(void);

Queue queue[MAX];
int head;
int tail;

main(){
  int n, q, i, sum;
  Queue box;

  sum = 0;

  scanf("%d%d", &n, &q);

  initialize();

  for( i = 0; i < n; i++){
    scanf("%s%d", box.name, &box.time);
    enqueue(box);
  }

  while( head != tail ){
    box = dequeue();
    if( box.time  > q ){
      sum += q;
      box.time -= q;
      enqueue(box);
    }
    else{
      sum += box.time;
      printf("%s %d\n", box.name, sum);
    }
  }

  return 0;

}

void initialize(void){
  head = 0;
  tail = 0;
}

void enqueue(Queue x){

  if( isFull() == 1 ) printf("オーバーフロー\n");

  queue[tail] = x;

  if( tail + 1 == MAX ) tail = 0;
  else tail++;

}

Queue dequeue(void){
  Queue x;

  if( isEmpty() == 1 ) printf("アンダーフロー\n");

  x = queue[head];

  if( head + 1 == MAX ) head = 0;
  else head++;

  return x;

}

int isEmpty(void){
  if( head == tail ) return 1;
  else return 0;
}

int isFull(void){
  if( head == ( tail + 1 ) % MAX ) return 1;
  else return 0;
}

Measured memory_bytes: 2160
pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);
 
impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}

fn solve(a: f64, b: f64, n: f64) -> i32 {
    f64::floor(a/b*(b-1.0).min(n)) as i32
}

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let ans = solve(sc.read(), sc.read(), sc.read());
    println!("{}", ans);
}
 


Measured memory_bytes: 2656