akhauriyash/Code-Regression huggingface dataset:
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data',function (chunk)
{
  var x = parseInt(chunk.trim(), 10);
  var h = Math.floor(x / 3600);
  var mod = x % 3600;
  var m = Math.floor(mod / 60);
  s = mod % 60;
  console.log(h + ":" + m + ":" + s);
});

Measured memory_bytes: 15528
//#pragma GCC optimize("Ofast")
//#pragma GCC target("avx,avx2,fma")
//#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(),a.end()
#define forn(i,n) for(int i=0;i<int(n);i++)
#define forr(i,n) for(int i=int(n-1);i>=0;i--)
#define fora(i,a,b) for(int i=int(a);i<=int(b);i++)
#define forb(i,a,b) for(int i=int(a);i>=int(b);i--)
#define mod 998244353 
using namespace std;
using ll=long long int;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<ll> vii;
typedef pair<ll ,ll> pii;

void solve()
{
	string s;
	cin>>s;
	if(s[s.size()-1]=='s')s+="es";
	else s+='s';
	cout<<s<<endl;
}

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int t=1;
    //cin>>t;
	//init();
    while(t--)
	solve();
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>

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

Measured memory_bytes: 1156
# AGC038A - 01 Matrix
def main():
    H, W, A, B = map(int, input().split())
    x = "0" * A + "1" * (W - A)
    y = "1" * A + "0" * (W - A)
    ans = [x] * B + [y] * (H - B)
    print("\n".join(ans))


if __name__ == "__main__":
    main()

Measured memory_bytes: 6004
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string>
#include <set>
#include <math.h>
#include <map>
#include <stack>
using namespace std;
static const int INF = 1e9+7;
// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, a, b) for (int i =a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define PI 3.14159265359

int main(){
    int N, T; cin >> N >> T;
    vector<pair<int, int>> pairs(N);
    int min_time = 2000;
    int min_cost = 2000;
    rep(i, N){
        cin >> pairs[i].first >> pairs[i].second;
        if(pairs[i].second <= T and pairs[i].first < min_cost){
            min_time = pairs[i].second;
            min_cost = pairs[i].first;
        }
    }

    if(min_cost == 2000){
        cout << "TLE" << endl;
    }else{
        cout << min_cost << endl;
    }

    return 0;
}


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

int main() {
  int a,b,c;
  cin >> a;
  
  b = a/10;
  c = a%10;
  
  if(b==9||c==9){
    cout <<"Yes"<<endl;
  }
  
  else{
    cout << "No" <<endl;
  }

}

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

int main() {
  ll n;
  cin >> n;
  
  ll ans=0;
  
  if(n<10){
    cout << "Yes" << endl;
    return 0;
  }
  
  for(int i=1; i<n+1; i*=10){
    ans+=n/i-n/(i*10)*10;
  }
  
  if(n%ans==0) cout << "Yes"  << endl;
  else cout << "No" << endl;
  
}


Measured memory_bytes: 256
from collections import Counter

N, K = map(int, input().split())
A = Counter(map(int, input().split()))
if len(A) <= K:
    print(0)
    exit(0)
ans = 0
Y = list(sorted(A.items(), key=lambda x: x[1]))
for i in range(0, len(A)-K):
    ans += Y[i][1]
print(ans)


Measured memory_bytes: 41500
a = input()
b = a.split("/")
c = [int(n) for n in b]

if c[0] > 2019:
    print("TBD")
elif c[0] < 2019:
    print("Heisei")
else:
    if c[1] >=5:
        print("TBD")
    else:
        print("Heisei")

Measured memory_bytes: 3060
import math
R, G, B, N = map(int, input().split())
ans = 0
cr = math.ceil(N/R)
cg = math.ceil(N/G)
cb = math.ceil(N/B)
for i in range(cr + 1):
    for j in range(cg + 1):
        tmp =  i * R + j * G
        if N - tmp >= 0 and (N - tmp) % B == 0:
           ans += 1
        elif N - tmp < 0:
          break
print(ans)


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)

#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)

#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n");
// }}} 2

// }}} 1

int main() {

    int N;
    Scd(N);

    int A,B,C,D;
    Scd2(A,B);
    Scd2(C,D);
    A--,B--,C--,D--;

    static char S[200032];
    Scs(S);

    int beg = A;
    int fin = max(C,D);

    bool ans = true;

    int cnt = 0;
    int cntr = 0;

    int yuyo = 0;

    bool rev = C > D;

    Rep(i,N){
        if( i < B ) cnt = 0;
        if( i > D+1 ) cnt = 0;
        if( S[i] == '#' ){
            cnt = 0;
            cntr++;
        }else{
            cnt++;
            if( cntr > 1 ){
                if( i > A && i <= C) ans = false;
                if( i > B && i <= D) ans = false;
            }
            if( i > A && i <= C ){
                yuyo = max( yuyo, cnt );
            }
            cntr = 0;
        }
    }
            yuyo = max( yuyo, cnt );

    if( C > D ){
        if( yuyo < 3 ) ans = false;
    }


    YesNo(ans);


    return 0;
}



Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void)
{
	int e;
	while(cin >> e && e > 0){
		int mini=e;
		for(int z=0;z*z*z<=e;z++){
			int z3 = z*z*z;
			int y=0, x;
			while((x = e-z3-y*y) >= 0){
				mini = min(mini, x+y+z);
				y++;
			}
		}
		cout << mini << endl;
	}
	return 0;
}


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

// マクロ
// forループ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(ll)(b);i--)
// xにはvectorなどのコンテナ
#define ALL(x) (x)begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
// 出力
#define PRINT(x) cout<<(x)<<endl
#define PRINTA(x,n) REP(i,n)PRINT(x[i])
// 定数
#define INF 1000000000000 // 10^12
#define MOD 1000000007 // 10^9+7
// 略記
#define PB push_back
#define MP make_pair



int main() {
    ll a; cin >> a;
    string b; cin >> b;
    ll c = (b[0] - '0') * 100 + (b[2] - '0') * 10 + (b[3] - '0');
    ll ans = a * c;
    ans /= 100;
    PRINT(ans);
    return 0;
}

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

namespace CSharp
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var N = input[0];
            var M = input[1];

            Console.WriteLine(N * (N - 1) / 2 + M * (M - 1) / 2);
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int k, x;
	cin >> k >> x;
	for(int i = x - k + 1; i < x + k; i++) {
		cout << i << ' ';
	}
	cout << endl;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

const int INF = (int) 1e9 + 1e6 + 123;
const ll LINF = (ll) 1e18 + 1e9 + 123;
const ld EPS = (ld) 1e-7;
const ll MOD = (ll) 1e9 + 7;

#define sz(x) (int) (x).size()
#define mp(x, y) make_pair(x, y)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb(s, t, x) (int) (lower_bound(s, t, x) - s)
#define ub(s, t, x) (int) (upper_bound(s, t, x) - s)
#define rep(i, f, t) for (int i = f; i < t; i++)
#define per(i, f, t) for (int i = f; i >= t; i--)

ll power(ll x, ll y, ll mod = MOD) {
    if (y == 0) {
        return 1;
    }
    if (y & 1) {
        return power(x, y - 1, mod) * x % mod;
    } else {
        ll tmp = power(x, y / 2, mod);
        return tmp * tmp % mod;
    }
}

template<typename A, typename B> bool mini(A &x, const B &y) {
    if (y < x) {
        x = y;
        return true;
    }
    return false;
}

template<typename A, typename B> bool maxi(A &x, const B &y) {
    if (y > x) {
        x = y;
        return true;
    }
    return false;
}

void add(ll &x, ll y) {
	x += y;
	if (x >= MOD) x -= MOD;
	if (x < 0) x += MOD;
}

ll mult(ll x, ll y) {
	return x * y % MOD;
}

void run();

#define TASK ""

int main() {
#ifdef LOCAL
    if (strlen(TASK) > 0) {
        cerr << "Reminder: you are using file i/o, filename: " TASK "!" << endl << endl;
    }
#endif
#ifndef LOCAL
    if (strlen(TASK)) {
        freopen(TASK ".in", "r", stdin);
        freopen(TASK ".out", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
#endif
    cout << fixed << setprecision(12);
    run();
    return 0;
}

// == SOLUTION == //

void run() {
	int n, a, b;
	cin >> n >> a >> b;
	if (abs(a - b) % 2 == 0) {
		cout << "Alice\n";
	} else {
		cout << "Borys\n";
	}
}


Measured memory_bytes: 256
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TupleSections #-}
module Main where

import           Data.List
import           Control.Monad
import           Debug.Trace
import qualified Data.ByteString.Char8         as BC
import           Data.Maybe                     ( fromJust, fromMaybe )
import qualified Data.Set                      as S
import qualified Data.IntMap.Strict            as IM
import qualified Data.IntMap.Lazy            as IML
import qualified Data.Map.Strict               as M
import           Data.Char
import qualified Data.Array.IArray as A
import qualified Data.Array.Unboxed as UA
import Data.Bits
import Control.Monad.State.Strict
import qualified Data.Array.ST as STA
import qualified Data.Array.IO as IOA
import qualified Data.Array.MArray as MA
import Control.Monad.ST
import System.IO (stdin)
import Control.Arrow
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as UV
import qualified Data.Vector.Generic as GV
import qualified Data.Vector.Mutable as MV
import Data.Ix
import Data.Ord (Down(Down))
import qualified Data.Sequence as Seq
import Data.Foldable (toList)
-- import Control.Lens

debug = False

ts :: Show a => a -> a
ts a = if debug then traceShowId a else a


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- readInts
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- readInts
    return (a, b, c)


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

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

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

zeroPad :: Int -> String -> String
zeroPad num s = reverse . take num . reverse $ (take num $ repeat '0') ++ s

solve :: Int -> Int -> [(Int, Int)] -> [String]
solve n m pys = makeId <$> pys where
  prefYearMap :: M.Map Int [Int]
  !prefYearMap = foldl' (\m (pref, year) -> M.alter (Just . maybe [year] (year:)) pref m) M.empty pys
  yearOrderMap :: Int -> M.Map Int Int
  yearOrderMap pref = M.fromList $ zip (sort $ M.findWithDefault [] pref prefYearMap) [1..]
  !prefYearOrderMap = M.fromList $ zip [1..] $ yearOrderMap <$> [1..n]
  makeId (pref, year) = (zeroPad 6 (show pref)) ++ (zeroPad 6 . show $ prefYearOrderMap M.! pref M.! year)

main :: IO ()
main = do
  (n, m) <- readTuple2
  pys <- replicateM m readTuple2
  forM_ (solve n m pys) putStrLn




Measured memory_bytes: 81020
#include<bits/stdc++.h>
using namespace std;
#define flash ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define pb push_back
#define all(v) (v).begin(),(v).end() 
#define endl "\n"
#define int long long int
#define ll long long
#define ld long double
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
const int mod = 1000000007;
const int N=200005;
const int inf=1e18;
vector<vector<int>>adj(N);

bool isprime(int n){for(int i=2;i*i<=n;++i){if(n%i==0){return false;}}return true;}
int factorial(int n){return (n==1 || n==0) ? 1:n*factorial(n-1);} 
int gcd(int a,int b){if (a==0)return b;return gcd(b%a,a);}
int lcm(int a,int b){return (a/gcd(a,b)*b);}
int max(int a,int b){int sol=a>b?a:b;return sol;}
int min(int a,int b){int sol=a<b?a:b;return sol;} 

void fun(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}


signed main(){
    flash;
    fun();
    int t=1;
    //cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int x;
        int ans=0;
        for(int i=0;i<n;i++){
            cin>>x;
            ans+=min(2*abs(0-x),abs(k-x)*2);
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

long int com_2(long int a){
    long int c;
    c=a*(a-1)/2;
    return c;
}

int main (){
    
    int n;
    long int ans =0;
    cin >> n;
    vector <long int> vec(n+1);
    vec[0]=0;
    rep(i,n){
        long int p;
        cin >>p;
        vec[i+1]=vec[i]+p;
    }
    map<long int,int> mp;
    rep(i,n+1) mp[vec[i]]++;
    for(auto &p:mp){
        long int a=p.second;
        ans+=com_2(a);
    }

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


Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N=1e5+5;

int deg[5];

int32_t main()
{
	IOS;
	for(int i=1;i<=3;i++)
	{
		int u, v;
		cin>>u>>v;
		deg[u]++;
		deg[v]++;
	}
	int odd=0;
	for(int i=1;i<=4;i++)
	{
		if(deg[i]>2)
		{
			cout<<"NO";
			return 0;
		}
		odd+=(deg[i]%2);
	}
	if(odd==2)
		cout<<"YES";
	else
		cout<<"NO";
	return 0;
}


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

#define N 100
#define rep(i, n) for(int i=0; i<n; i++)
#define pow2(x) ((x)*(x))
#define S "Safe\n"
#define D "Danger\n"

int dist(int x1,int y1,int x2,int y2){
	return pow2(x1-x2)+pow2(y1-y2);
}

int main(){
	int n,m;
	int wx[N],wy[N],r[N];
	bool safe;
	int tx,ty,sx,sy;
	while(cin>>n,n){
		rep(i,n){
			cin>>wx[i]>>wy[i]>>r[i];
			r[i]*=r[i];
		}
		cin>>m;
		rep(i,m){
			cin>>tx>>ty>>sx>>sy;
			int dx=sx-tx,dy=sy-ty;
			safe=0;
			rep(j,n){
				if((dist(tx,ty,wx[j],wy[j])<=r[j])^(dist(sx,sy,wx[j],wy[j])<=r[j])){
					safe=1;
					break;
				}
				//この先危険
				//http://marupeke296.com/COL_2D_No5_PolygonToCircle.html
				int t0=pow2(dx)+pow2(dy);
				int t1=-(dx*(tx-wx[j])+dy*(ty-wy[j]));
				if(!(dist(sx,sy,wx[j],wy[j])<=r[j])&&!(dist(tx,ty,wx[j],wy[j])<=r[j])&&0<=t1&&t1<=t0&&pow2( dx*(ty-wy[j]) - dy*(tx-wx[j]) ) <= t0*r[j]){
					safe=1;
					break;
				}
			}
			cout<<(safe?S:D);
		}
	}
	
	return 0;
}


Measured memory_bytes: 1120
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>
#include<math.h>

typedef int32_t i32;
typedef int64_t i64;

#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) > (0) ? (a) : -(a))



void run (void) {
  char *s = (char *) calloc (200000 + 1, sizeof (char));
  scanf ("%s", s);
  i32 n = strlen (s);
  s[n] = 'B';
  i64 ans = 0;
  i32 i = 0;
  while (i < n) {
    if (s[i] != 'A') {
      i++;
      continue;
    }
    i32 a = 0;
    while (i < n) {
      if (s[i] == 'A') {
	a++;
	i++;
      } else if (s[i] == 'B' && s[i + 1] == 'C') {
	ans += a;
	i += 2;
      } else {
	break;
      }
    }
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


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

if N >= 64:
  print(64)
elif N >=32:
  print(32)
elif N >= 16:
  print(16)
elif N >= 8:
  print(8)
elif N >= 4:
  print(4)
elif N >= 2:
  print(2)
else:
  print(1)

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll N,K;
ll arr[1000010];

bool judge(ll x){
    ll cnt = 0;
    for(int i = 1;i<N;i++){
        if(arr[i]>=0){
            ll l = i+1,r = N,mid;
            if(arr[i]*arr[l]>=x) continue;
            while(l<r){
                mid = (l+r+1)>>1;
                if(arr[i]*arr[mid] < x) l = mid;
                else r = mid-1;
            }
            cnt += l-i;
        }else{
            ll l = i+1,r = N,mid;
            if(arr[i]*arr[N] >= x) continue;
            if(arr[i]*arr[l]<x){
                cnt += N-l+1;
                continue;
            }
            while(l<r){
                mid = (l+r+1)>>1;
                if(arr[i]*arr[mid] >= x) l = mid;
                else r = mid-1;
            }
            cnt += N-l;
        }
    }
    return cnt < K;
}

int main(){
    cin>>N>>K;
    for(int i = 1;i<=N;i++) scanf("%lld",&arr[i]);
    sort(arr+1,arr+N+1);
    ll l = -1e18-10,r = 1e18+10,mid;
    while(l<r){
        mid = (l+r+1)>>1;
        if(judge(mid)) l = mid;
        else r = mid-1;
    }
    cout<<l<<endl;


    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define dump(x) cout << #x << " = " << (x) << endl;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N + 2, 0);
  FOR(i, 1, N + 1) { cin >> A[i]; }
  vector<int> d(N + 1);
  REP(i, N + 1) {
    d[i] = A[i + 1] - A[i];
  }

  int sum = 0;
  REP(i, N + 1) { sum += abs(d[i]); }
  // A[i]をぬく
  FOR(i, 1, N + 1) {
    int tmp = sum;
    tmp -= abs(d[i - 1]) + abs(d[i]);
    tmp += abs(d[i - 1] + d[i]);
    cout << tmp << endl;
  }
  return 0;
}

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

long long int N, b[4], i;
char a[9];

int main(){
    scanf("%s", a);
    for(int i = 0; i < 4; ++i){
        N += (b[i] = a[i] - 48);
    }
    N = (N - 7) / 2;
    for(int i = 0; i < 16; i += 2){
        int k = 0;
        for(int j = 0; j < 4; ++j){
            k += b[j] * ((i >> j) & 1);
        }
        if(k == N){
            cout << *b;
            for(int j = 1; j < 4; ++j){
                cout << ((i >> j) & 1 ? '-' : '+') << b[j];
            }
            cout << "=7";
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 256
if isfile("mystdin.txt");mystdin=open("mystdin.txt","r");redirect_stdin(mystdin);end
macro p(z);:((x->parse(Int,x)).(split($z)));end
function main()
  n,k=@p(readline())
  p=(x->(1+x)/2).(@p(readline()))
  sp=Float64[]
  sum=0
  for i=p
    sum+=i
    push!(sp,sum)
  end
  print(k==n ? sp[k] : maximum(push!([sp[i+k]-sp[i] for i=1:n-k],sp[k])))
end
main()
if isdefined(Base, :mystdin);close(mystdin);end


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

bool pr[1001];
vector<int> p;
int fr[1001], md = 1e9 + 7;

int main(){
	f(i, 2, 1001)if (!pr[i]){
		for(int j = i * i; j <= 1000; j += i)pr[j] = true;
		p.push_back(i);
	}
	int n;
	scanf("%d", &n);
	f(i, 2, n + 1){
		int t = i, j = 0;
		while (t > 1){
			while (t % p[j] == 0)++fr[j], t /= p[j];
			++j;
		}
	}
	int an = 1;
	f(i, 0, p.size())an = (ll)an * (fr[i] + 1) % md;
	printf("%d\n", an);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long int
using namespace std;
int main(void)
{
	int n,p[110],flg[110]={0},mx=-1,cnt,i,j;
	cin>>n;
	for(i=0;i<n;i++) cin>>p[i],mx=max(p[i],mx);
	for(i=mx;i>0;i--) {
		cnt=0;
		for(j=0;j<n;j++) {
			if(p[j]>=i) cnt++;
		}
		if(i<=cnt) {
			cout<<i<<endl;
			break;
		}
	}
}

Measured memory_bytes: 3120
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
  int n,i,j,tal[26],al[26];string s;char z;cin >> n;
  for(i=0;i<26;i++) tal[i] = 50;
  for(i=0;i<n;i++){
    cin >> s;
    for(j=0;j<26;j++) al[j] = 0;
    for(j=0;j<s.size();j++) al[s[j]-'a']++;
    for(j=0;j<26;j++) tal[j] = min(tal[j],al[j]);
  }
  for(i=0;i<26;i++){
    z = i+int('a');
    for(j=0;j<tal[i];j++) cout << z;
  }
  cout << endl;
}

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

using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N ; i++) {
    cin >> A[i];
  }
  ll res = 0;
  for (int i = 0; i < N; i++) {
    res += 1LL * A[i] / 2;
    A[i] %= 2;
    if (i < N - 1 && A[i] > 0 && A[i + 1] > 0) {
      res++;
      A[i]--, A[i + 1]--;
    }
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;

char c[9];

int main() {
	for (int i = 0; i != 9; ++i)
		cin >> c[i];
	cout << c[0] << c[4] << c[8] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const ll MOD = 1000000007;
const ll INF = 1000000000000000;
#define all(v) v.begin(), v.end()


int main(){
  ll N,M;
  cin >> N >> M;
  vector<ll> A(N,1),B(N,0);
  B.at(0)=1;
  rep(i,M){
    ll x,y;
    cin >> x >> y;
    x--;
    y--;
    if(B.at(x)==1){
      if(A.at(x)==1){
        B.at(x)=0;
        A.at(x)=0;
        A.at(y)++;
        B.at(y)=1;
      }else{
        A.at(x)--;
        A.at(y)++;
        B.at(y)=1;
      }
    }else{
      A.at(x)--;
      A.at(y)++;
    }
  }
  ll ans=0;
  rep(i,N){
    if(B.at(i)==1){
      ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4700
#include <bits/stdc++.h>
#include <complex>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,C,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
const long double EPS = 1e-9;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    cin>>N;
    set<ll> s;
    rep(i,N){
        cin>>A;
        if(s.find(A) == s.end()){
            s.insert(A);
        }else{
            s.erase(A);
        }
    }
    cout<<s.size()<<endl;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,k; string f[805];
bool u[805][805];queue<P>que;int dist[805][805];
int main(){
	cin>>n>>m>>k;
	rep(i,805)rep(j,805)dist[i][j]=INF;
	rep(i,n){
		cin>>f[i];
		rep(j,m) if(f[i][j]=='S'){
			que.push(mp(i,j)); dist[i][j] = 0;
		}
	}
	while(!que.empty()){
		P p=que.front();que.pop();
		if(u[p.fi][p.sc])continue;u[p.fi][p.sc]=1;
		int dx[4]={0,1,0,-1};
		int dy[4]={1,0,-1,0};
		rep(k,4){
			int nx=p.fi+dx[k],ny=p.sc+dy[k];
			if(0<=nx&&nx<n&&0<=ny&&ny<m&&f[nx][ny]!='#'){
				dist[nx][ny] = min(dist[nx][ny],dist[p.fi][p.sc]+1);
				que.push(mp(nx,ny));
			}
		}
	}
	int ret = INF;
	rep(i,n)rep(j,m){
		if(dist[i][j]<=k){
			int x = min(min(i,n-1-i),min(j,m-1-j));
			ret = min(ret,1+(x+k-1)/k);
		}
	}
	cout<<ret<<endl;
}

Measured memory_bytes: 4352
#include <stdio.h>
int main(void){
    double N,sum=0;
    double x;
    
    scanf("%lf",&N);
    for(double i=1;i<=9;i++){
        x=N/i;
        for(double j=1;j<=9;j++){
            if(x==j){
                sum+=1;
                i=10;
            }
            else{
                sum+=0;
            }
        }
    }
    if(sum==0){
        printf("No\n");
    }
    else{
        printf("Yes\n");
    }
    return 0;
}

Measured memory_bytes: 128
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int,input().split())
    L=[list(map(int,input().split())) for i in range(n)]
    L=sorted(L, key=lambda x: x[0])
    
    
    cnt=0
    for i in range(n):
        temp=cnt
        cnt+=L[i][1]
        if cnt==k:
            print(L[i][0])
            break
        elif cnt>k and temp<k:
            print(L[i][0])
            break
        elif cnt>k and temp>=k:
            print(L[i-1][0])
            break

    
resolve()

Measured memory_bytes: 60892
import numpy as np
n, d = map(int, input().split())

x = []
for i in range(n):
    x.append(list(map(int, input().split())))
    
ans = 0
for idx, point in enumerate(x):
    for idx2 in range(idx+1, len(x), 1):
    
        norm =  np.linalg.norm(np.asarray(point) - np.asarray(x[idx2]))
        if norm % 1 == 0:
            ans += 1
print(ans)

Measured memory_bytes: 20760
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    ll sum=min(k,a);
    k-=sum;
    ll x=min(b,k);
    k-=x;
    x=min(k,c);
    sum-=x;
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 3636
import math

n = int(input())
a = list(map(int, input().split()))
a.sort()
d = []
flag = a[0]
for i in range(1, n):
    if a[i] == flag:
        d.append(a[i])
    else:
        flag = a[i]

ans = n - 2 * math.ceil(len(d) / 2)
print(ans)


Measured memory_bytes: 14396
class MonoImage(private val state: Array<BooleanArray>){
    val size: Int = state.size
    private var mNotSymmetricPixelCount: Int
    private val mPixels: Array<Array<Pixel>>
    init{
        mPixels = Array(size / 2){Array(size / 2){Pixel()}}
        mNotSymmetricPixelCount = 0
        for (i in 0 until size / 2){
            for (j in 0 until size / 2){
                mPixels[i][j].topLeft = state[i][j]
                mPixels[i][j].topRight = state[i][size - 1 - j]
                mPixels[i][j].bottomLeft = state[size - 1 - i][j]
                mPixels[i][j].bottomRight = state[size - 1 - i][size - 1 - j]
                if (!mPixels[i][j].isSymmetric) ++mNotSymmetricPixelCount
            }
        }
    }
    val isSymmetric: Boolean
        get() = mNotSymmetricPixelCount == 0
    private fun pixel(row: Int, column: Int): Pixel {
        return when{
            row in 0 until size / 2 && column in 0 until size / 2 -> mPixels[row][column]
            row in 0 until size / 2 -> mPixels[row][size - column - 1]
            column in 0 until size / 2 -> mPixels[size - row - 1][column]
            else -> mPixels[size - row - 1][size - column - 1]
        }
    }
    fun flip(row: Int, column: Int): Unit {
        if (!pixel(row - 1, column - 1).isSymmetric) --mNotSymmetricPixelCount
        when{
            (row - 1) in 0 until size / 2 && (column - 1) in 0 until size / 2 -> pixel(row - 1, column - 1).flipTopLeft()
            (row - 1) in 0 until size / 2 -> pixel(row - 1, column - 1).flipTopRight()
            (column - 1) in 0 until size / 2 -> pixel(row - 1 , column - 1).flipBottomLeft()
            else -> pixel(row - 1, column - 1).flipBottomRight()
        }
        if (!pixel(row - 1, column - 1).isSymmetric) ++mNotSymmetricPixelCount

    }
    class Pixel(var topLeft: Boolean = false, var topRight: Boolean = false, var bottomLeft: Boolean = false, var bottomRight: Boolean = false){
        val isSymmetric: Boolean
            get() = (topLeft == topRight) && (topLeft == bottomLeft) && (bottomLeft == bottomRight)
        fun flipTopLeft(): Unit {topLeft = !topLeft}
        fun flipTopRight(): Unit {topRight = !topRight}
        fun flipBottomLeft(): Unit {bottomLeft = !bottomLeft}
        fun flipBottomRight(): Unit {bottomRight = !bottomRight}
    }

}
fun main(args:Array<String>): Unit {
    val (c, n) = readLine()!!.trim().split(' ').map(String::toInt)
    val image = MonoImage(Array(n){readLine()!!.trim().toCharArray().map{it == '1'}.toBooleanArray()})
    var count = if (image.isSymmetric) 1 else 0
    repeat(c - 1){
        repeat(readLine()!!.trim().toInt()){
            val (row, column) = readLine()!!.trim().split(' ').map(String::toInt)
            image.flip(row, column)
        }
        if (image.isSymmetric) ++count
    }
    println(count)
}


Measured memory_bytes: 185316
n,m = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(n)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]
for i in range(m):
    b[i] = int(input())
for i in range(n):
        for j in range(m):
            c[i] += a[i][j] * b[j]
print('\n'.join(map(str,c)))

Measured memory_bytes: 8004
import std.stdio;
import std.conv;
import std.string;
import std.format;

void main()
{
  string s = chomp(readln());
  int min = to!int(s.split(" ")[0]);
  int max = to!int(s.split(" ")[1]);
  int val = to!int(s.split(" ")[2]);

  int result = 0;

  for (int i = min; i <= max; i++ ) {
    if (val % i == 0) {
      result++;
    }
  }

  writeln(result);
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

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

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;

void solve() {
    int n;
    cin >> n;
    vector<ll> a(n+1);
    for (int i=0; i<n+1; ++i) {
        cin >> a.at(i);
    }

    ll res = 0;
    vector<ll> cap(n+1);
    for (int i=n-1; i>=0; --i) cap.at(i) = cap.at(i+1) + a.at(i+1);
    ll cur = 1;
    for (int i=0; i<n+1; ++i) {
        if ((i != n && cur <= a.at(i)) || (i == n && cur != a.at(i))) {
            cout << -1 << '\n';
            return;
        }
        res += cur;
        cur -= a.at(i);
        cur = min(cur*2, cap.at(i));
    }

    cout << res << '\n';
}

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

    solve();

    return 0;
}


Measured memory_bytes: 4780
N = gets.to_i
ary = []
N.times do
    d1, d2 = gets.split.map(&:to_i)
    ary << (d1 == d2)
end
(N-2).times do |n|
    if ary[n] && ary[n+1] && ary[n+2]
        puts 'Yes'
        exit
    end
end
puts 'No'

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

using namespace std;

#define int long long
#define pii pair<int,int>

const int MaxN=100*1000+10;
int arr[MaxN];
int ps[MaxN];

int findRightSticky(int s,int e){
	int mx=arr[e];
	int ind=e;
	for (int i=s;i<=e;++i)
		if (mx<ps[e]-ps[i-1]){
			mx=ps[e]-ps[i-1];
			ind=i;
		}
	return ind;
}

int findLeftSticky(int s,int e){
	int mx=arr[s];
	int ind=s;
	for (int i=s;i<=e;++i)
		if (mx<ps[i]-ps[s-1]){
			mx=ps[i]-ps[s-1];
			ind=i;
		}
	return ind;
}

pair<int,int> findMaxSubarray(int s,int e){
	if (s==e)
		return make_pair(s,s);
	int mid=(s+e)/2;
	pii mxsubleft=findMaxSubarray(s,mid);
	pii mxsubright=findMaxSubarray(mid+1,e);
	int mxstickyleft=findRightSticky(s,mid);
	int mxstickyright=findLeftSticky(mid+1,e);
	int totalmx=max(ps[mxstickyright]-ps[mxstickyleft-1],max(ps[mxsubleft.second]-ps[mxsubleft.first-1],ps[mxsubright.second]-ps[mxsubright.first-1]));
	if (totalmx==ps[mxsubleft.second]-ps[mxsubleft.first-1])
		return mxsubleft;
	else if (totalmx==ps[mxsubright.second]-ps[mxsubright.first-1])
		return mxsubright;
	else
		return make_pair(mxstickyleft,mxstickyright);
}

int32_t main(){
	int n;
	cin >> n;
	while(n){
		for (int i=1;i<=n;++i){
			cin >> arr[i];
			ps[i]=ps[i-1]+arr[i];
		}
		pii prd=findMaxSubarray(1,n);
		cout << ps[prd.second]-ps[prd.first-1] << endl;
		cin >> n;
	}
	// cout << prd.first-1 << " " << prd.second-1 << endl;
}


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

using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble
#define PI 3 .14159265

//typedef tuple <int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

#define siz(x) (int)(x).size()
#define Y second
#define X first
#define IN insert
#define PB push_back
#define P pop_back
#define PU push
#define PO pop
//#define F find
#define ED end()
#define MP(a,b) make_pair( a, b )

#define MOD 1000000007LL
#define INF 1000000000
#define rep(a,i,b) for (ll i = (a); i < (b); ++i)
#define reps(a,i,b) for (ll i = (a); i <= (b); ++i)
#define repd( num, i, ed ) for(ll (i)= (num)-1; (i) >= e38d; --(i))
#define repkt( bg, i, num, kt ) for(ll (i)= (bg); (i) < (num) && (kt); ++(i))
#define repchar( i ) for(char (i)= 48; (i) <= 122; (i)++)   
#define in(n) scanf("%lld", &n)
#define out(n) printf("%lld\n", n)
#define outS(s) printf("%s\n", s)
#define setA(a,n) for(ll i= 0, j= sizeof(a)/sizeof(a[0]); i < j; ++i) a[i]= n;
#define repe(num,i,ed) for(ll (i)= (num); (i) >= ed; --(i))
#define endl "\n"
const int mod =1e9+7;
int n;
int main()
{
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
    // freopen("input.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    cin>>n;
    vector<int> dp(3,0);
    vector<int> tmp(3);
    for(int i=0;i<3;++i) cin>>dp[i],tmp[i]=dp[i];
    for(int day=2;day<=n;++day)
    {
        int choose[3];
        for(int i=0;i<3;++i) cin>>choose[i];
        dp[0]=choose[0]+max(tmp[1],tmp[2]);
        dp[1]=choose[1]+max(tmp[0],tmp[2]);
        dp[2]=choose[2]+max(tmp[0],tmp[1]);
        for(int i=0;i<3;++i) tmp[i]=dp[i];
    }
    cout<<max({dp[0],dp[1],dp[2]});
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <vector>
#include <algorithm>
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {
    return b ? gcd(b, a % b) : a;
}
int main() {
    int k;
    cin >>k;
    
    ll total = 0;
    for (int a = 1; a <= k; a++) {
        for (int b = 1; b <=k; b++) {
            for (int c = 1; c <= k; c++) {
                total += gcd(a, gcd(b, c));
            }
        }
    }
    cout << total << endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);

//int dxy[5] = {0, 1, 0, -1, 0};
// assign

signed main()
{
    int2(n, x);
    int a, b, ans = 0, z = 0;
    cin >> a;
    Rep(i, n) {
        cin >> b;
        int res = max(z, (a+b)-x);
        int tmp = min(b, res);
        ans += tmp + max(z, res-b);
        a = b - tmp;
    }
    cout << ans << endl;

    return 0;
}



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

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  cin >> A >> B;
  int one;
  int two;
  int three;
  int four;
  int five;
  int count=0;
  
  for(int i = A;i<B+1;i++){
    one = i/10000;
    two = (i-one*10000)/1000;
    three = (i-one*10000-two*1000)/100;
     four = (i-one*10000-two*1000-three*100)/10;
    five = i-one*10000-two*1000-three*100-four*10;
    
    if(one == five && two == four){
    count++;
    }
  } 
  cout << count << endl;
}

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

class Program
{
    static void Main(string[] args)
    {
        //List<int> values = new List<int>(Console.ReadLine().Split(' ').Select(s => int.Parse(s)));
        //List<int> values = new List<int>();

        string input = Console.ReadLine();
        //int n = int.Parse(input.Split(' ')[0]);
        //int m = int.Parse(input.Split(' ')[1]);
        //int k = int.Parse(input.Split(' ')[2]);

        if (input.StartsWith("keyence"))
        {
            Console.WriteLine("YES");
            return;
        }

        if (input.StartsWith("keyenc") & input.EndsWith("e"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.StartsWith("keyen") & input.EndsWith("ce"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.StartsWith("keye") & input.EndsWith("nce"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.StartsWith("key") & input.EndsWith("ence"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.StartsWith("ke") & input.EndsWith("yence"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.StartsWith("k") & input.EndsWith("eyence"))
        {
            Console.WriteLine("YES");
            return;
        }
        if (input.EndsWith("keyence"))
        {
            Console.WriteLine("YES");
            return;
        }


        Console.WriteLine("NO");
        
    }
}

Measured memory_bytes: 13280
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

		int xdiff = x2 - x1;
		int ydiff = y2 - y1;

		int x3 = x2 - ydiff;
		int y3 = y2 + xdiff;

		int x4 = x3 - xdiff;
		int y4 = y3 - ydiff;

		System.out.println(x3 + " " + y3 + " " + x4 + " " + y4);
	}
}

Measured memory_bytes: 22604
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A,B,C,D;
    cin >>A>>B>>C>>D;
    cout << max(A*B,C*D)<<endl;



}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, start, end) for(int i = (start); i < (end); i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;


void solve()
{
    string s; cin >> s;
    s.replace(5, 1, " ");
    s.replace(13, 1, " ");
    cout << s << endl;
}

int main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();

    return 0;
}

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

int main(void)
{
  int n,k,x,y,ans;
  n = k = x = y = ans = 0;
  
  cin >> n >> k >> x >> y;
  
  for(int i = 1;i <= n;i++)
  {
    if(k < i){ans += y;}
    else{ans += x;}
  }
  
  cout << ans;
  
  return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int a,b,c;
    cin >> a>>b>>c;
    int ans=min(a+b+1,c)+b;

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
a,b=map(int,input().split())
if a%2==0:
    if b%2==0:
        use=((b-a)//2)%2
        print(use^b) 
    else:
        use=((b-a+1)//2)%2
        print(use)
else:
    temp=a 
    a+=1
    if b%2==0:
        use=((b-a)//2)%2
        print(temp^use^b) 
    else:
        use=((b-a+1)//2)%2
        print(temp^use)   

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

void main() {
	auto data = readln.split, H = data[0].to!uint, W = data[1].to!uint;
	uint[501][501] coin;
	foreach (i; 0 .. H) foreach (j, a; readln.split.to!(uint[])) {
		coin[i][j] = a;
	}
	
	alias Point = Tuple!(int, "x", int, "y");
	Point[501*501] p;
	int dy = 1;
	uint y;
	foreach (x; 0 .. H) {
		foreach(i; 0 .. W)
			p[x*W + i] = Point(x, y), y += dy;
		y -= dy;
		dy = -dy;
	}
	
	Tuple!(Point, Point)[] points;
	foreach (i; 0 .. H*W-1) {
		if (coin[p[i].x][p[i].y] % 2 == 1) {
			points ~= tuple(p[i], p[i+1]);
			coin[p[i].x][p[i].y]--, coin[p[i+1].x][p[i+1].y]++;
		}
	}
	writeln(points.length);
	foreach (a; points) {
		writeln(a[0].x+1, " ", a[0].y+1, " ", a[1].x+1, " ", a[1].y+1 );
	}
}

Measured memory_bytes: 9724
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
#include <map>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <cctype>
#include <queue>
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define REP1(j,n) for(int j=0;j<(int)n;++j)
#define REPD(i,n) for(int i=n;i>=0;--i)
#define REPD1(j,n) for(int j=n;j=>0;--j)
#define REPS(i,n) for(int i=1;i<=(int)n;++i)
#define REPS1(j,n) for(int j=1;j<=(int)n;++j)
#define rep(i,a,n) for(int i=a;i<=(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;
const ll INF=1e9+7;

int main(void) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = tolower(s[k - 1]);
	cout << s << endl;
	return 0;
}

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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<set<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

// int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const int INF = 100000000;


int main() {

  ll X;
  cin >> X;
  ll A = 119, B = 0;

  for( A = -1000; A < 1000; A++){
    for( B = -1000; B < 1000; B++){
      if(((A*A*A*A*A)-(B*B*B*B*B))==X){
        cout << A << " " << B << endl;
        return 0;
      }
    }
  }


  


}


/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/


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

typedef struct node *link;
struct node{
  int key;
  link le,ri,pa;
};
link head;

void insert(int a);
void inorder(link h);
void preorder(link h);

int main(){
  int m,k;
  char op[10];
  int i;

  head=NULL;
  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%s",op);
    if(strcmp(op,"insert")==0){
      scanf("%d",&k);
      insert(k);
    }else if(strcmp(op,"print")==0){
      inorder(head);
      printf("\n");
      preorder(head);
      printf("\n");
    }
  }

  return 0;
}

void insert(int a){
  link x,y,z;
  z=malloc(sizeof(struct node));
  z->key=a; z->le=NULL; z->ri=NULL;
  y=NULL;  x=head;
  while(x!=NULL){
    y=x;
    if(z->key<x->key)   x=x->le;
    else                x=x->ri;
  }
  z->pa=y;

  if(y==NULL)             head=z;
  else if(z->key<y->key)  y->le=z;
  else                    y->ri=z;
}

void inorder(link h){
  if(h==NULL) return;
  inorder(h->le);
  printf(" %d",h->key);
  inorder(h->ri);
}

void preorder(link h){
  if(h==NULL) return;
  printf(" %d",h->key);
  preorder(h->le);
  preorder(h->ri);
}


Measured memory_bytes: 25208
#include <iostream>
#include <stdio.h>
#include <vector>
#include <cstring>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <utility>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>

#define INF 1e9
#define nmax 500010
#define fst first
#define snd second
#define pb push_back
#define SZ(x) ((int)(x.size()))

#define MOD 998244353

#define MOD1 998244353
#define MOD2 666013
#define P1 255
#define P2 2059

using namespace std;

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

int n;
int t[110];

int main()
{
    scanf("%d", &n);

    for (int i = 1; i <= n; i++) scanf("%d", &t[i]);

    int minn = 1e9;

    for (int i = 1; i <= 100; i++) {

        int sum = 0;

        for (int j = 1; j <= n; j++) sum = sum + (t[j] - i) * (t[j] - i);

        minn = min(minn, sum);

    }

    printf("%d", minn);

    // IMPORTANT!!!!!
    // Are you missing something????
    // check limits, int or ll

    return 0;
}

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

long long n;
vector<string> s;
map<string, long long> mp;

long long solve();

int main() {
  cin >> n;
  s.resize(n);
  for(int i = 0; i < n; ++i) cin >> s[i];
  cout << solve() << endl;
  return 0;
}

long long solve() {
  long long ans = 0;
  for(int i = 0; i < n; ++i) {
    sort(s[i].begin(), s[i].end());
    ++mp[s[i]];
  }
  for(auto now : mp) {
    long long x = now.second;
    ans += x * (x - 1) / 2;
  }
  return ans;
}

Measured memory_bytes: 18176
#include<bits/stdc++.h>
using namespace std;
int main(){
    const int mod=1000000007;
    int n;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    vector<int>v;//0:横置き、1:縦置き
    for(int i=0;i<n;i++){
        if(s1[i]==s2[i])v.push_back(1);
        else{
            v.push_back(0);
            i++;
        }
    }
    long long x;
    if(v[0])x=3;
    else x=6;
    for(int i=1;i<v.size();i++){
        if(v[i-1])x*=2;
        if(v[i-1]==0 && v[i]==0)x*=3;
        x%=mod;
    }
    cout<<x<<endl;
    return 0;
}

Measured memory_bytes: 256