akhauriyash/Code-Regression huggingface dataset:
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
-- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Monad.Primitive
import           Control.Applicative
import           Debug.Trace
import           Text.Printf

main = do
  (a,b) <- getInt2Tuple
  print $ a*b

readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons
getInt = readLn :: IO Int
getInt2Tuple = (\vec -> (vec VU.! 0, vec VU.! 1)) <$> getIntVector
getInt3Tuple = (\vec -> (vec VU.! 0, vec VU.! 1, vec VU.! 2)) <$> getIntVector


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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

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

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector< pair<int, bool> > v;
    int cnt = 1;
    bool flg;
    if( s[0] == '0' ) flg = false;
    else flg = true;
    for( int i = 1; i < n; ++i ) {
        if( s[i] != s[i - 1] ) {
            v.pb(MP(cnt, flg));
            flg = !flg;
            cnt = 0;

        }
        ++cnt;

    }
    v.pb(MP(cnt, flg));

    int l = 0, r = 1;
    int res = 0;
    cnt = 0;
    int zcnt = 0;
    if( !v[0].S ) {
        zcnt = 1;
        if( v.size() != 1 ) {
            cnt += v[1].F;
            r = 2;

        }
    }
    cnt += v[0].F;
    res = max(cnt, res);

    while( l < v.size() ) {
        if( r < v.size() && zcnt < k ) {
            while( r < v.size() && zcnt < k ) {
                cnt += v[r].F;
                res = max(res, cnt);
                if( !v[r].S ) ++zcnt;
                ++r;

            }
            if( r < v.size() ) {
                cnt += v[r++].F;

            }
            res = max(res, cnt);

        }
        cnt -= v[l].F;
        if( !v[l].S ) --zcnt;
        ++l;
        res = max(res, cnt);

    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 1528
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1'010'000'000'000'000'017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

int main() {
    // AtCoder
    // template
    ll n, k;
    cin >> n >> k;

    ll ans = n;
    if(ans >= k)
        ans = ans % k;
    ans = min(ans, k - ans);
    cout << ans;
}


Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
cnt = [0]*(N+1)
for i in range(N):
    cnt[i+1] = cnt[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(cnt[r-1] - cnt[l-1])

Measured memory_bytes: 13012
#include<bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define EPS (1e-10)

using namespace std;


vector<int>  dx = {1,-1,0,0};
vector<int>  dy = {0,0,1,-1};


int main() {
	
	while(1) {
		int n ; cin >> n;
		if(n == 0) break;

		int ans = 0;
		for (int i = 1; i < n; i++) {
			int sum = 0;	
			for (int j = i; j <= n; j++) {
				sum += j;
				if(sum == n) {
					ans++;
					break;
				}else if (sum > n) {
					break;
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}



Measured memory_bytes: 3148
import Data.List
main :: IO()
main = do
  _ <- getLine
  ps <- map read . words <$> getLine
  print $ slv ps 0
 
slv :: [Integer] -> Integer -> Integer
slv p ret | (length p) < 3 = ret
          | sec == p !! 1 = slv (tail p) (ret + 1)
          | otherwise = slv (tail p) ret
  where sec = (sort (take 3 p)) !! 1

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

 
int main() {
 int n,k,ans=0;
 cin >> n >> k;
 int p[n];
 for(int i=0;i<n;i++){
   cin >> p[i];
 }

sort(p,p+n);
for(int i=0;i<k;i++){
   ans +=p[i];
}

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

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
  long long i,K,A,B,N=1;
  cin >> K >> A >> B;
  if (A+2 >= B) {
    cout << K+1 << endl;
    return 0;
  }
  if ((A+K)%2==0) {
    N+=A;
    N+=(K-A)/2 * (B-A);
    cout << N << endl;
  } else {
    N+=A-1;
    N+=(K-A+1)/2 * (B-A);
    cout << N << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
template <class T>
inline void rd(T &x) {
	x=0; char c=getchar(); int f=1;
	while(!isdigit(c)) { if(c=='-') f=-1; c=getchar(); }
	while(isdigit(c)) x=x*10-'0'+c,c=getchar(); x*=f;
}
const int N=1e5+10;
int n,a[N]; 
int main() {
	rd(n);
	for(int i=0;i<n;++i) rd(a[i]);
	sort(a,a+n,greater<int>());
	int x=0,y=0;
	while(y+1<a[x+1]) x++,y++;
	
	int t1=!((a[x]-(y+1))&1);
	int r=x; while(y<a[r+1]) r++;
	int t2=!((r+1-(x+1))&1);
	
	if(!(t1&t2)) printf("First");
	else printf("Second");
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
using namespace std;
#define lint long long int
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
*/

int main() {
	string S;
	cin >> S;
	int Z = S.size();
	int ans1 = 0;
	int ans2 = 0;
	for (int i = 0; i < Z; i++) {
		if (i % 2 == 0 && S[i] == '0')ans1++;
		if (i % 2 == 1 && S[i] == '1') ans1++;
	}
	for (int i = 0; i < Z; i++) {
		if (i % 2 == 0 && S[i] == '1')ans2++;
		if (i % 2 == 1 && S[i] == '0') ans2++;
	}
	cout << min(ans1, ans2) << endl;
}


Measured memory_bytes: 512
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

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

int main()
{
	int w;

	while(cin >> w, w >= 0)
	{
		int res = 1150;
		
		if( w > 10 )
			res += min(1250, (w-10)*125);
		if( w > 20 )
			res += min(1400, (w-20)*140);
		if( w > 30 )
			res += (w-30)*160;
			
		cout << 4280 - res << endl;
	}
	
	return 0;
}

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

int main(){
	int n;
	int a[30], b[30], c[30];
	cin >> n;
	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n-1) cin >> c[i];
	int ans = 0;
	rep(i, n){
		ans += b[i];
	}
	rep(i, n-1){
		if((a[i] + 1) == a[i+1]) ans += c[a[i] - 1];
	}
	cout << ans << endl;
}


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

int main() {
  int N, K, num = 1;
  cin >> N >> K;

  for (int i = 0; i < N; i++){
    if (num * 2 < num + K) {
        num *= 2;  
    } else {
        num += K;
    }
  }

  cout << num << endl;
}


Measured memory_bytes: 256
s = list(map(int, input()))

def getsum(t, total, sum_left=0):
  if len(t) == 1:
    total += sum_left + t[0]

  else:
    t0 = [t[0]*10 + t[1],] + t[2:]
    total = getsum(t0, total, sum_left)
    
    t1 = t[1:]
    sum_left += t[0]
    total = getsum(t1, total, sum_left)
  
  return total

print(getsum(s, 0))

Measured memory_bytes: 3064
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		while( scan.hasNextInt() ) {
			Integer[] ary = new Integer[6];
			
			for(int i = 0; i < 6; i++) {
				ary[i] = scan.nextInt();
			}
			
			double x = (double)1 / (double)((ary[0]*ary[4])-(ary[1]*ary[3])) * (double)((ary[4]*ary[2])-(ary[1]*ary[5]));
			double y = (double)1 / (double)((ary[0]*ary[4])-(ary[1]*ary[3])) * (double)((-(ary[2]*ary[3])+(ary[0]*ary[5])));
			
			if(Math.abs(x) < 0.005) {
				x = 0;
			}
			if(Math.abs(y) < 0.005) {
				y = 0;
			}
			
			System.out.printf("%.3f %.3f\n", x, y);
			
		}
	}
}

Measured memory_bytes: 18208
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int b = 5;
		int f = 4;
		int r = 11;
		int count[][][] = new int[b][f][r];
		for (int i = 0; i < n; i++) {
			b = sc.nextInt();
			f = sc.nextInt();
			r = sc.nextInt();
			count[b][f][r] += sc.nextInt();
		}
		for (int i = 0; i < 5; i++) {
			for (int j = 0; j < 4; j++) {
				for (int k = 0; k < 11; k++) {
					if (i != 0 && j != 0 && k != 0) {
						System.out.print(" " + count[i][j][k]);
					}
				}
				if (i != 0 && j != 0) {
					System.out.println();
				}
			}
			if (i < 4 && i != 0) {
				System.out.println("####################");
			}
		}
	}
}


Measured memory_bytes: 29988
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    a, b, c, x, y = MI()

    ans = 0
    if a + b <= 2 * c:
        mn = min(x, y)
        ans = a * mn + b * mn
        x -= mn
        y -= mn

        if x < y:
            x = y
            a = b

        if a > 2*c:
            ans += x * 2 * c
        else:
            ans += x * a

    else:
        mn = min(x, y)
        ans = mn * 2 * c
        x -= mn
        y -= mn

        if x < y:
            x = y
            a = b

        if a > 2 * c:
            ans += x * 2 * c
        else:
            ans += x * a

    print(ans)



if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>

using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

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

    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int minitue = (h2 - h1) * 60 + m2 - m1;
    int res = minitue - k;
    if (res < 0) res = 0;
    cout << res << "\n";
}

Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
using namespace std;
   
int main()
{
	char a;
	int as;
	int c[26];
	for(int i=0; i<26; i++)
		c[i] = 0;
	scanf("%c", &a);
	while(1) {
		as = (int)a;
		if ((as >= 0x41)&&(as <=0x5a))
			c[as-0x41] += 1;
		if ((as >= 0x61)&&(as <=0x7a))
			c[as-0x61] += 1;
		if (as==0x0a){
			scanf("%c", &a);
			as = (int)a;
			if(((as<0x41)||(as>0x51))&&((as<0x61)||(as>0x7a)))
				break;
		}
		else
			scanf("%c", &a);
	}
	for(int i=0; i<26; i++)
		printf("%c : %d\n",0x61+i,c[i]);
	return 0;
}

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

    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;

    void solve(){
        char c;
        cin>>c;
        if(c>='a' && c<='z')
            cout<<'a';
        else
            cout<<'A';
    }
    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


Measured memory_bytes: 3584
/*
**   Contest : Educational DP Contest
**   Problem : D - Knapsack 1
**
**    Author : Dhiraj Govindvira
**      Date : 05-Jun-2020 ~ Friday
**      Time : 02:59:49 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T> 
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U> 
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T> 
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

void solve(ll &T)
{
    ll n, w;
    cin>>n>>w;

    vector<pair<ll,ll>> ks(n);
    cin>>ks;

    unordered_map<ll,ll> dp;
    ll ans = 0;
    for(ll i=1; i<=n; i++)
    {
        ll W = ks[i-1].first;
        ll V = ks[i-1].second;

        for(ll j=w; j>=0; j--)
        {
            if(j >= W) {
                dp[j] = max(dp[j], dp[j-W] + V);
                ans = max(ans, dp[j]);
            }
            else break;
        }
    }
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<'\n';
        solve(Case);
    }
    return 0;
}

Measured memory_bytes: 4388
package main
import "fmt"
func main() {
  var s string
  fmt.Scan(&s)
  n := len(s)
  if s[n-1:n] == "1" { fmt.Println(-1);return }
  if s[0:1] == "0" { fmt.Println(-1);return }
  for i:=0;i<n-i-2;i++ {
    if s[i:i+1] != s[n-i-2:n-i-1] { fmt.Println(-1);return }
  }
  p,c := n,n-1
  for i:=n-1;i>0;i-- {
    fmt.Println(c,p)
    c = i-1
    if s[i-1:i] == "1" { p = i }
  }
}

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

using namespace std;

using ll = long long;

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

    char c;
    cin >> c;
    if (c == 'A') cout << "T\n";
    else if (c == 'T') cout << "A\n";
    else if (c == 'C') cout << "G\n";
    else if (c == 'G') cout << "C\n";

    return 0;
}


Measured memory_bytes: 256
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};

int main(void){
  int N; cin >> N;
  vector<int> A(N); rep(i, N) cin >> A[i];
  vector<int> C(N+1, 1);
  set<int> all;
  rep(i, N){
    if(all.count(A[i]-1)) C[A[i]] = C[A[i]-1] + 1;
    all.insert(A[i]);
  }
  ll ans = 0;
  rep(i, N+1) ans = max(ans, C[i]);
  cout << N - ans << endl;
}


Measured memory_bytes: 11136
#include <iostream>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    int a, b, c, x, y;
    int sumA;
    int sumB;
    int sumC;
    cin >> a >> b >> c >> x >> y;
    sumA = a * x + b * y;
    if (x > y){
        sumB = x * 2 * c;
    } else {
        sumB = y * 2 * c;
    }
    if (x > y){
        sumC = y * 2 * c;
        sumC += (x - y) * a;
    } else {
        sumC = x * 2 * c;
        sumC += (y - x) * b;
    }
    int ret = min({sumA, sumB, sumC});
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n); i >= 0; i--)
#define loop(i, r, n) for (int i = (r); i < (n); i++)
#define pb push_back
#define all(in) in.begin(),in.end()

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; }

using ll = long long;
using ull = unsigned long long;
using namespace std;
using namespace atcoder;
// cout << fixed << setprecision(10）<<  << endl;

int main(){
    int n; cin >> n;
    rep(i,n) cout << "ACL";
}

Measured memory_bytes: 3628
#include<stdio.h>

int main(){
	
	int num[10],i,x,y,max1,max2,max3;
	
	for(i=0;i<10;i++)scanf("%d",&num[i]);
	
	max1=num[0];
	
	max3=num[0];
	
	for(i=0;i<10;i++){
		
		if(max1<=num[i]){
			max1=num[i];
			x=i;
		}
	}
	
	if(max1==num[0]){max2=num[1];}
	else{max2=num[0];}
	
	for(i=0;i<10;i++){
		
		if(max2<=num[i]&&i!=x){
			max2=num[i];
			y=i;
		}
	}
	if(max1==num[0]){max3=num[1];}
	else{max3=num[0];}
	if(max2==num[1]){max3=num[2];}
	else{max3=num[1];}
	
	for(i=0;i<10;i++){
		
		if(max3<=num[i]&&i!=x&&i!=y){
			max3=num[i];
			}
		}
	printf("%d\n%d\n%d\n",max1,max2,max3);
	return(0);
}

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

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

//---------------------------

int main(){
    int r,g,b; cin >> r >> g >> b;
    if((100*r + 10*g + b)%4) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define inf 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define inv(x) Power(x, mod - 2)
#define fi first
#define se second
#define MP make_pair
#define PB push_back

using namespace std;
typedef pair<int,int> Pair;
typedef long double ld;
typedef long long ll;

const int mod = 998244353, MAX = 1e5, N = 200005;
//template{{{
const long double Pi = 3.14159265358979323846l;
inline int add(int x, int y) { x += y; return x >= mod ? x - mod : x; };
inline void inc(int &x, int y) { x += y; x -= (x >= mod ? mod : 0); }
inline int mul(int x, int y) { return 1ll * x * y % mod; }
inline int Power(int x, int y) {
	int ans = 1;
	while (y) {
		if (y & 1) ans = mul(ans, x);
		x = mul(x, x), y >>= 1;
	} return ans;
}

/*char buf[1<<23],obuf[1<<23],*p1=buf,*p2=buf, *O = obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
void print(int x) {
    if(x > 9) print(x / 10);
    *O++=x%10+'0';
} */

template <class T> inline T	input() {
	T x; char ch; bool flag = false;
	while (!isdigit(ch = getchar())) flag |= ch == '-';
	for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48));
	return flag ? -x : x;
}

template <class T> inline bool chkmin(T &x, T y) { x = x < y ? x : y; return x == y; }
template <class T> inline bool chkmax(T &x, T y) { x = x > y ? x : y; return x == y; }
template <class T> inline T gcd(T x, T y) { return !y ? x : gcd(y, x % y); }
template <class T> inline T sqrm(T x) { return (ll) x * x % mod; }
template <class T> inline T sqr(T x) { return x * x; }

struct {
	inline operator int () { return input<int>(); }
	inline operator long long () { return input<long long>(); }
	template <class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read; //}}}

int n;
int a[N];
ll dp[N][2][2];

int main() {
#ifdef local
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
	freopen("log", "w", stderr);
#endif

	read(n);
	for (int i = 1; i <= n; ++i) read(a[i]);

	memset(dp, 0x80, sizeof dp);
	dp[0][1][0] = 0;
	for (int i = 1; i <= n; ++i) {
		if (i & 1) {
			chkmax(dp[i][0][0], dp[i - 1][1][0]);
			chkmax(dp[i][0][0], dp[i - 1][1][1]);
			chkmax(dp[i][0][1], dp[i - 1][0][0] + a[i]);
			chkmax(dp[i][1][1], dp[i - 1][1][0] + a[i]);
		} else {
			chkmax(dp[i][0][0], dp[i - 1][0][0]);
			chkmax(dp[i][0][0], dp[i - 1][0][1]);
			chkmax(dp[i][1][0], dp[i - 1][1][0]);
			chkmax(dp[i][1][0], dp[i - 1][1][1]);
			chkmax(dp[i][1][1], dp[i - 1][0][0] + a[i]);
		}
	}

	printf("%lld\n", max(dp[n][!(n & 1)][0], dp[n][!(n & 1)][1]));
	return 0;
}


Measured memory_bytes: 10780
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn calc(rest: u32, n: u32, satun: usize, satuv: &Vec<u32>, ans: (u32, u32, u32)) -> Option<(u32, u32, u32)> {
    let satu = satuv[satun];

    if satun == satuv.len() - 1 {
        if rest == satu * n {
            return Some((ans.0, ans.1, n));
        } else {
            return None;
        }
    }

    if rest > satu * n {
        return None
    }

    let rem = rest / satu;
    for i in (0..rem+1).rev() {
        if satu * i > rest || i > n { continue; }
        let ans_next = if satun == 0 { (i, ans.1, ans.2) } else { (ans.0, i, ans.2) };
        match calc(rest - satu * i, n - i, satun + 1, satuv, ans_next) {
            None => continue,
            Some(a) => return Some(a),
        }
    }

    None
}



fn main() {
    let v = read_vec::<u32>();
    let n: u32 = v[0];
    let y: u32 = v[1];

    let satuv = vec![10000, 5000, 1000];

    match calc(y, n, 0, &satuv, (0, 0, 0)) {
        None => println!("-1 -1 -1"),
        Some((i, j, k)) => println!("{} {} {}", i, j, k),
    }
}


Measured memory_bytes: 4352
INF = 10 ** 9
n, m, l = map(int, input().split())
d = [[INF for j in range(n + 1)] for i in range(n + 1)]
d2 = [[INF for j in range(n + 1)] for i in range(n + 1)]
for _ in range(m):
    i, j, c = map(int, input().split())
    d[i][j] = c
    d[j][i] = c
    if c <= l:
        d2[i][j] = 1
        d2[j][i] = 1

q = int(input())
Q = [list(map(int, input().split())) for _ in range(q)]

for k in range(1, n + 1):
    for i in range(1, n):
        for j in range(i, n + 1):
            dk = d[i][k] + d[k][j]
            if d[i][j] > dk:
                d[i][j] = dk
                d[j][i] = dk
                if dk <= l:
                    d2[i][j] = 1
                    d2[j][i] = 1

for k in range(1, n + 1):
    for i in range(1, n):
        for j in range(i, n + 1):
            dk = d2[i][k] + d2[k][j]
            if d2[i][j] > dk:
                d2[i][j] = dk
                d2[j][i] = dk

for i in range(q):
    s, t = Q[i]
    di = d2[s][t]
    if di >= INF:
        print(-1)
    else:
        print(di - 1)


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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;

#define pb push_back
#define ff first
#define ss second
#define SIZE 200001
#define INF int(2e9 + 9)
#define BIG_INF 1e18 + 9
#define acmpIN "input.txt"
#define acmpOUT "output.txt"
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

//#pragma GCC optimize("Ofast")

ll n, a[SIZE], b[SIZE], c[SIZE];

vector<int> g[SIZE];


ll Ans = 0;

pii dfs(int u, int p, ll mn)
{
    pii cur = {0, 0};
    if(b[u] != c[u])
    {
        if(b[u]) cur.ff++;
        else cur.ss++;
    }

    for(int v: g[u])
    {
        if(v == p) continue;
        pii given = dfs(v, u, min(mn, a[u]));
        cur.ff += given.ff;
        cur.ss += given.ss;
    }

    if(a[u] < mn)
    {
        ll kol = min(cur.ff, cur.ss);
        Ans += 2 * kol * a[u];
        cur.ff -= kol;
        cur.ss -= kol;
    }
    return cur;
}


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
//    freopen(acmpIN, "r", stdin);
//    freopen(acmpOUT, "w", stdout);

    cin >> n;


    queue<ll> q;
    for(int i = 1; i <= 9; i++)
    {
        q.push(i);
    }
    ll top = 0;
    while(n--)
    {
        top = q.front();
        q.pop();
        if(top % 10 != 0)
        {
            q.push(top * 10 + top % 10 - 1);
        }
        q.push(top * 10 + top % 10);
        if(top % 10 != 9)
        {
            q.push(top * 10 + top % 10 + 1);
        }
    }

    cout << top;
    return 0;
}



Measured memory_bytes: 9540
import collections
N=int(input())
A=list(map(int,input().split()))
l=[0]
l2=[]
for i in range(N):
    l.append(l[len(l)-1]+A[i])
#print(l)
ans=0
c=collections.Counter(l)
values=list(c.values())	#aのCollectionのvalue値のリスト(n_1こ、n_2こ…)
key=list(c.keys())	#先のvalue値に相当する要素のリスト(要素1,要素2,…)
for i in range(len(key)):
    l2.append([key[i],values[i]])#lは[要素i,n_i]の情報を詰めたmatrix
for i in range(len(key)):
    ans=ans+(l2[i][1]*(l2[i][1]-1))//2
print(ans)

Measured memory_bytes: 124352
/*
元の文字列が全て同じ文字からなれば1通り。
そうではなく元の文字列の長さが2なら2通り。
どちらにも該当しないとする。

「○○に操作を行って××にできるか？」は
・必要条件を考える（必要条件を与える不変量を考える）
・必要条件が実は十分条件になってないか考える
とすれば解けることが多い（要出典）

操作は"平均"を取ったと考えられそう。
これはa～cを0～2に変換してmod 3で考えることで正当化される。
つまり元の文字列から作れる文字列の必要条件は
・和のmod 3が元の文字列と等しい
・同じ文字が連続する箇所がある
となる。これで十分条件になるか？

前から貪欲でよさそう？
先頭がaのときbにできることを言えばよい
・2文字目がaのとき
初めてaではないものが出てくるところから前へいくとできる
例：aab→acc→bbc→baa→cca
aの数が増えたりb,cを入れ替えても同様に成り立つ
・2文字目がbのとき
aba→acc→bbc
abb→ccb→caa→bba
abc→できない(もしb..の形にできるなら必要条件からそれはbbb)
・2文字目がcのとき
ac→bb

abc→bbb（とそのpermutation）だけができない
4文字のときは
aabc→accc→bbcc→baac→babb→(bab→abbはできる)→abbb
babc→ccbc→caac→cabb→bbbb
cabc→bbbc→bbaa→bcca→bcbb→(bcb→cbbはできる)→cbbb
でできる

つまり4文字以上のとき、目指す文字列をつくるには「『同じものが連続している箇所』を含むような3文字の部分文字列」を残してそれ以外の部分を端から貪欲につくればよい。
まとめると
4文字以上のときは必要条件が十分条件になっている
3文字のときはabc→bbbとそのpermutationだけできない。他はできる

よって4文字以上のときは、上で述べた条件を満たすような文字列の個数を数えれば良い
dp[n][i][j][k]=n文字であって、現在の末尾の文字がi、和のmod 3がj、同じ文字が連続する箇所が(k?ある:ない)ようなものの数
としてdpでできる
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define MOD 998244353

char s[200010];
ll dp[200010][3][3][2];
//n文字であって、現在の末尾の文字がi、和のmod 3がj、同じ文字が連続する箇所が(k?ある:ない)ようなものの数

int main(){
	scanf("%s",s);
	
	//同じ文字が連続する箇所があるか、全てが同じ文字か、文字列の長さは
	int N=strlen(s);
	int con=0,ss[3]={};
	rep(i,0,N){
		ss[s[i]-'a']++;
		if(i&&s[i-1]==s[i])con=1;
	}
	
	if(ss[0]==N||ss[1]==N||ss[2]==N){
		//文字が1種類
		puts("1");
		return 0;
	}
	if(N==2){
		//2
		puts("2");
		return 0;
	}
	if(N==3){
		//3
		if(ss[0]==1&&ss[1]==1)puts("3");
		else printf("%d\n",6+!con);
		return 0;
	}
	
	//メイン
	dp[1][0][0][0]=dp[1][1][1][0]=dp[1][2][2][0]=1;
	rep(n,1,N)rep(i,0,3)rep(j,0,3)rep(k,0,2){
		rep(d,0,3)dp[n+1][d][(j+d)%3][k|(i==d)]=(dp[n+1][d][(j+d)%3][k|(i==d)]+dp[n][i][j][k])%MOD;
	}
	ll ans=0;
	rep(i,0,3)ans+=dp[N][i][(ss[1]+2*ss[2])%3][1];
	printf("%d\n",(ans+!con)%MOD);
}

Measured memory_bytes: 28544
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int k,s;
    cin >> k >> s;
    int cnt = 0;
    for(int x = 0; x <= k; x++){
        for(int y = 0; y <= k; y++){
            if(0 <= s - x - y && s - x - y <= k) cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pp pair<int,int>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ll long long
#define all(a) (a).begin(),(a).end()
ll MOD=1000000007;
ll mod=998244353;
int inf=1000001000;
ll INF=10000000000000000;


int main(){
    ll n,k;
    cin >> n >> k;
    vector<ll> b(n);
    vector<pair<ll,ll>> a(n);
    rep(i,n) cin >> b.at(i);
    rep(i,n){
        rep(j,n){
            if (b.at(i)>b.at(j)){
                a.at(i).first++;
                if (i>j) a.at(i).second++;
            }
        }
    }
    ll ans=0;
    rep(i,n){
        ll o=((k+1)*k/2)%MOD,oo=(a.at(i).second*k)%MOD;
        ll q=(o*a.at(i).first-oo+2*MOD)%MOD;
        ans=(ans+q)%MOD;
        //cout << ans << endl;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int n, k, ans = 0;
  cin >> n;
  bool f = true;
  for(int i = 0;i < n;i++){
    char c;
    cin >> c >> k;
    if(c == '(')ans += k;
    else ans -= k;
    if( ans < 0 ) f = false;
  }
  cout << (!ans && f? "YES":"NO") << endl;
  
}

Measured memory_bytes: 1156
#include<stdio.h>

int pt(int*, int, int);

main(){
  int a[100001],i,n,sugi;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d", &a[i]);
    }
  //ここから
  sugi = pt(a,0,n-1);
  for(i=0;i<n;i++)
    {
      if(i == sugi){
	printf("[%d]",a[i]);
      }
      else{
	printf("%d",a[i]);
      }
      if(i!=n-1){
	printf(" ");
      }
    }


  printf("\n");
  return 0;
}

int pt(int *a, int b, int c)
{
  int x, i, j, tmp;
  x = a[c];
  i = b-1;
  for(j=b;j<c;j++)
    {
      if(a[j] <= x)
	{
	  i = i+1;
	  tmp =  a[i];
          a[i] = a[j];
          a[j] = tmp;
	}
    }
  tmp = a[i+1];
  a[i+1] = a[c];
  a[c] = tmp;
  return i+1;
}

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

vector<long> getArms(bool const& isEven, long const& dist_max) {
    // 腕の長さを 1,2,4,8, ... 2^iとすれば
    // 2^(i+1)-1の距離までのすべての奇数点に到達できる
    // 偶数点の場合は長さ1の腕を1本追加する

    vector<long> arms;

    // 偶数なら長さ1の腕を追加
    if(isEven) arms.push_back(1);

    int i = 0;
    long dist_remain = dist_max;
    while (dist_remain > 0) {
        long arm_length = pow(2, i);
        dist_remain -= arm_length;
        arms.push_back(arm_length);
        i++;
    }
    return arms;
}

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

    vector<long> x(n), y(n);
    for (int i = 0; i < n; i++) {
        cin >> x.at(i) >> y.at(i);
    }

    // 1点目の偶奇を調べる
    int odd_even = ( abs(x.at(0)) + abs(y.at(0)) ) % 2;
    bool isEven = false;
    if( odd_even % 2 == 0 ) isEven = true; 

    // 一番遠い座標をもとめる
    // ついでに偶奇が一致するかチェック
    long dist_max = 0;
    for (int i = 0; i < n; i++) {
        long dist = abs(x.at(i)) + abs(y.at(i));
        
        // 偶奇チェック
        if (dist % 2 != odd_even) {
            cout << "-1" << endl;
            return 0;
        }

        // 更新
        if (dist > dist_max) dist_max = dist;
    }

    // 腕を設定
    vector<long> arms = getArms(isEven, dist_max);

    // 腕の情報を出力
    cout << arms.size() << endl;
    for (int i = 0, len = arms.size(); i < len; i++) {
        cout << arms.at(i);
        if (i != len-1) cout << " ";
    }
    cout << endl;

    // 各点について
    for (int i = 0; i < n; i++) {
        int xm = x.at(i);
        int ym = y.at(i);

        // 腕のパターン
        vector<char> ptn;
        
        // 後ろの腕から考える
        for (int i = arms.size()-1; i >= 0; i--) {
            // 腕の長さ
            long arm_length = arms.at(i);

            // 到達目標点から逆算する
            // x, yの絶対値の大きい方から長い腕を使って原点に近づくようにする
            if ( abs(xm) > abs(ym) ) {
                // LR
                if ( xm > 0 ) {
                    xm -= arm_length;
                    ptn.push_back('R');
                } else {
                    xm += arm_length;
                    ptn.push_back('L');
                }
            } else {
                // UD
                if (ym > 0) {
                    ym -= arm_length;
                    ptn.push_back('U');
                } else {
                    ym += arm_length;
                    ptn.push_back('D');
                }
            }
        }
        reverse(ptn.begin(), ptn.end());
        
        // パターンを出力
        for (int i = 0; i < ptn.size(); i++) {
            cout << ptn.at(i);
        }
        cout << endl;
    }
    

}

Measured memory_bytes: 512
<?php
while (true) {
    
   list($height, $width) = getInputExplodeBySpaces();
    
    if ($height == 0 && $width == 0) {
       break;
    }
    
    $FrameRectangle = new FrameRectangle($height, $width);
    $lines = $FrameRectangle->drawFrameRectangle();
    
    echo implode($lines), PHP_EOL;
}

function getInputExplodeBySpaces()
{
    return explode(' ', trim(fgets(STDIN)));
}
 
class Rectangle
{
    public $height;
    public $width;
    public $output;
    public $hashSymbol  = '#';
    
    public function __construct($height, $width)
    {
        $this->height = $height;
        $this->width  = $width;
    }
    
    public function drawRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            $lines[] = $this->drawHashSymbolLine();
        }
        return $lines;
    }
    
    public function drawHashSymbolLine()
    {
        return str_repeat($this->hashSymbol, $this->width).PHP_EOL;
    }
}

class FrameRectangle extends Rectangle
{
    public $dotSymbol = '.';
    
    public function drawFrameRectangle()
    {
        for ($i = 0; $i < $this->height; $i++) {
            if ($i == 0 || ($i == $this->height - 1)) {
                $lines[] = $this->drawHashSymbolLine();
            } else {
                $lines[] = $this->drawMiddleLine();
            }
        }
        return $lines;
    }
    
    public function drawMiddleLine()
    {
         return $this->hashSymbol.str_repeat($this->dotSymbol, $this->width - 2).$this->hashSymbol.PHP_EOL;
    }
}

Measured memory_bytes: 15392
#include <iostream>
#include <string>
using namespace std;
int ctoi(char a){
    return a-'0';
}
int main(void){
    string s;cin>>s;
    for(int i=0;i<(1<<3);i++){
        int cal=ctoi(s[0]);
        for(int j=0;j<3;j++){
            if((i>>j)%2==0){
                cal+=ctoi(s[j+1]);
            }else{
                cal-=ctoi(s[j+1]);
            }
        }
        if(cal==7){
            cout<<s[0];
            for(int k=0;k<3;k++){
                if((i>>k)%2==0){
                    cout<<"+";
                }else{
                    cout<<"-";
                }
                cout<<s[k+1];
            }
            cout<<"="<<cal<<"\n";
           return 0;
        }
        
    }
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a+b>c+d)cout<<"Left"<<endl;
	else if(a+b==c+d)cout<<"Balanced"<<endl;
	else cout<<"Right"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>

using namespace std;

int main(){
	int n,ans = 0,x = 0;
	string s;

	cin >> n >> s;

	for(int i = 0; i < n; i++){
		if(s[i] == 'I')x++;
		else x--;
		ans = max(ans,x);
	}

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

Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <list>
#include <stack>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi   vector<int> 
#define   co(x) cout << x << endl ; 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std; 

int  a, b, c, d, e, f, l, r ; 
 
signed main() 
{ 
    ld density = -1.0;
    cin >> a >> b >> c >> d >> e >> f ; 
    a *= 100; b *= 100 ; 
    l = a, r = 0 ; 
    for (int i=0;i<=30;i++){ 
        if (a*i > f)  break ; 
        for (int j=0;j<=30;j++){
            int w = a*i+b*j;
            if (w > f )  break ; 
            int dissolve = min( f-w, (e*(a/100)*i + e*(b/100)*j) ) ; 
            for (int  ic = dissolve/c; w>0 and ic>=0 ; ic--){ 
                int cur = ( ic * c ) + ( (dissolve - ic*c ) / d ) * d ; 
                ld cur_density = (1.0*cur) / w ; 
                if (cur_density > density){
                    density = cur_density;
                    l = w+cur;
                    r = cur; 
                }
            }
        }
    }
    co( l << " " << r ) ; 
    return  0 ; 
} 

/* 
100 200 10 20 30 
   
*/ 


Measured memory_bytes: 3556
#include <cstdio>
#include <utility>
#include <unordered_set>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	unordered_set<string> m;
	string s;
	bool k = false;
	for (int n = in(); n; n--) {
		scan(s);
		m.insert(s);
	}
	for (int n = in(); n; n--) {
		scan(s);
		auto r = m.find(s);
		if (r != m.end()) {
			outl(k ? "Closed by " : "Opened by ", s);
			k ^= true;
		} else
			outl("Unknown ", s);
	}
}


Measured memory_bytes: 2752
#include <iostream>
using namespace std;
int main(){
    int n,m,i,j,a,b,c,d,k;
    int A[100][100]={},B[100]={};
    cin>>n>>m;
    for(i=0;i<n;i++){
        for(j=0;j<m;j++){
            cin>>A[i][j];
        }
    }
    for(a=0;a<m;a++){
        cin>>B[a];
    }
    for(c=0;c<n;c++){
        k=0;
        for(d=0;d<m;d++){
           k+=A[c][d]*B[d] ;
        }
        cout<<k<<endl;
    }
   return 0; 
}



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

int main()
{
    int x, ans = 0;
    cin >> x;

    ans += x / 500 * 1000;
    x%=500;
    ans += x / 5 * 5;
    cout << ans << endl;
    return 0;
}

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<ll> A(N);
    REP(i,N) cin >> A[i];
    sort(all(A));
    int idx = lower_bound(all(A),0LL) - A.begin();
    idx = max(1, idx);
    idx = min(N-1, idx);
    ll ans = A[N-1] - A[0];
    for(int i=1; i<N-1; ++i) {
        if(A[i]<0) ans -= A[i];
        else ans += A[i];
    }
    cout << ans << endl;
    ll t1 = A[N-1];
    for(int i=1; i<idx; ++i) {
        cout << t1 << " " << A[i] << '\n';
        t1 -= A[i];
    }
    ll t2 = A[0];
    for(int i=idx; i<N-1; ++i) {
        cout << t2 << " " << A[i] << '\n';
        t2 -= A[i];
    }
    cout << t1 << " " << t2 << '\n';
    return 0;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using in6 = int64_t;
using ind = double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  int sum = 0;
  rep(i,3) {
    int a; 
    cin >> a;
    sum += a;
  }
  if(sum >= 22) cout << "bust" << endl;
  else cout << "win" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll l,r;
    cin >> l >> r;
    ll mx=2019;
    r=min(r,l+2019);
    for(ll i=l;i<=r;i++){
        for(ll j=i+1;j<=r;j++){
            ll res=(i%2019)*(j%2019);
            res=res%2019;
            if(res<mx){
                mx=res;
            }
        }
    }
    cout << mx << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define BUF 50
using namespace std;
ll MOD = 1e9 + 7;
ll A, B, C, D, G, H, N, M, L, K, P, Q, R, W, X, Y, Z;
string S;
ll ans = 0;

int main() {
	string S1, S2, S3;
	cin >> S1 >> S2 >> S3;
	cout << S1[0] << S2[1] << S3[2];
}

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

#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
int main()
{
	ll N; cin >> N;
	ll A[200];
	ll min = 1 << 10;

	rep(i, 0, N) {
		cin >> A[i];
		ll cnt = 0;
		while (A[i] % 2 == 0 && A[i] != 0) {
			A[i] /= 2;
			cnt++;
		}
		if (min > cnt) {
			min = cnt;
		}
	}
	cout << min << endl;
	return 0;
}

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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
	int n;
	string s;
	cin>>n>>s;
	rep(i,s.size()){
		int x=s[i]-'A';
		x=(x+n)%26;
		s[i]='A'+x;
	}
	rep(i,s.size()){
		cout<<s[i];
	}
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

int main()
{
    string s;
    cin >> s;

    if (s == "Sunny") {
        cout << "Cloudy" << endl;
    }
    if (s == "Cloudy") {
        cout << "Rainy" << endl;
    }
    if (s == "Rainy") {
        cout << "Sunny" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
     
    public void solve(){
        Scanner sc =new Scanner(System.in);
        int S = sc.nextInt();
        int h = S/3600;
        int m = (S-h*3600)/60;
        int s = S - h*3600 - m*60;
        System.out.println(h+":"+m+":"+s);
    }
     
    public static void main(String[]args){
        Main obj = new Main();
        obj.solve();
    }
}

Measured memory_bytes: 17352
#include <stdio.h>

int main(void)
{
	int a;
	int b;
	int c;
	
	scanf("%d %d %d", &a, &b, &c);
	
	if (a < b && b < c && a < c){
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	
	return 0;
}

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for(int i = 0; i < s.length; i += 2) {
			System.out.print(s[i]);
		}
	}

}


Measured memory_bytes: 30308
import itertools
a,b=map(int,input().split())
A=[]
for _ in range(a-1):
  A.append(_+2)
List=[list(map(int,input().split())) for i in range(b)]
count=0
for i in itertools.permutations(A):
  ju=True
  if [1,i[0]] in List or [i[0],1] in List:
    ju=True
  else:
    ju=False
  for j in range(a-2):
    if not([i[j],i[j+1]] in List) and not([i[j+1],i[j]] in List):
      ju=False
  if ju:
    count+=1
print(count)

Measured memory_bytes: 3064
using System;

class Tax{
  static void Main(){
      var input = int.Parse(Console.ReadLine());
      var pages = 0;
      
      if(input % 2 == 0){
          pages = input / 2;
      }else{
          pages = (input + 1 ) / 2;
      }
      
      Console.WriteLine(pages);
  }
}

Measured memory_bytes: 13140