akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
    int N;
    cin >> N;
    ll A[N];

    ll kane = 1000;
    ll kabu = 0;
    ll remain = 0;
    rep(i, N) {
        cin >> A[i];
        ll tmp_kane = kane;

        if (kane < kabu * A[i] + remain) {
            tmp_kane = kabu * A[i] + remain;
        }

        if (remain / A[i] > 0) {
            kabu += remain / A[i];
            remain = remain % A[i];
        }

        if (kabu == kane / A[i] && remain < kane % A[i]) {
            kabu = kane / A[i];
            remain = kane % A[i];
        } else if (kabu < kane / A[i]) {
            kabu = kane / A[i];
            remain = kane % A[i];
        }
        
        kane = tmp_kane;
    }

    cout << kane << endl;
    return 0;
}


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

int main(){

    int n; cin >> n;
    vector<long long> a(n);
    vector<long long> b(n);
    //long long num = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    for(int i = 0; i < n; i++){
        cin >> b[i];
    }
    long long s = 0;    
    for(int i = 0; i < n; i++){
        s += b[i] - a[i];
    }
    if(s < 0){
        cout << "No" << endl;
        return 0;
    }


    for(int i = 0; i < n; i++){
        
        if(a[i] > b[i]){
            s -= a[i] - b[i];
        }
        if(a[i] < b[i]){
            s -= (b[i] - a[i]) % 2;
        }
    }

    if(s >= 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

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



signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
    
    int n;
    cin>>n;
    int a[n];
    int d[25]={};
    d[0]=1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        d[a[i]]++;
        if(d[a[i]]>2){
            cout << 0 << endl;
            return 0;
        }
        if(d[12]>1 || d[0]>1){
            cout << 0 << endl;
            return 0;
        }
    }    
    bool pos =true;
    for(int i=0;i<=12;i++){
        if(d[i]==0) pos = false;
        if(i==0 || i==12 ){
            if(d[i]>=2){
                cout << 0 << endl;
                return 0;
            }
        }else{
            if(d[i]>=3){
                cout << 0 << endl;
                return 0;
            }
        }
    }
    if(pos){
        cout << 1 << endl;
        return 0;
    }
    int ans = 0;
    for(int i=0;i<(1<<n);i++){
        vector<int> v;
        for(int j=0;j<n;j++){
            if(i&(1<<j)){
                v.push_back(a[j]);
            }
            else v.push_back(24-a[j]);
        }
        v.push_back(0);
        sort(v.begin(),v.end());
        int ret=111;
        for(int j=0;j<n;j++){
            ret = min(ret,v[j+1]-v[j]);
            ret = min(ret,24-v[j+1]+v[j]);
        }
        ret = min(ret,(24-v[n]));
        ret = min(ret,v[n]);
        ans = max(ret,ans);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
 
#define $(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define endl '\n'
#define x first
#define y second
#define int long long
#define double long double
#define pii pair<int, int>
#define pb push_back
#define vec vector
#define beg begin
#define dbg(x) cout << #x << " = " << x << endl;
 
template<class T> ostream& operator<<(ostream &str, vector<T> &a) {
    for (auto &i : a) {
        str << i << " ";
    }
    return str;
}
 
template<class T> istream& operator>>(istream &str, vector<T> &a) {
    for (auto &i : a) {
        str >> i;
    }
    return str;
}
 
template<class T> ostream& operator<<(ostream &str, pair<T, T> &a) {
    str << a.first << " " << a.second;
    return str;
}
 
template<class T> istream& operator>>(istream &str, pair<T, T> &a) {
    str >> a.first >> a.second;
    return str;
}
 
void solve(); signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    srand(time(0));
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout.setf(ios::fixed); cout.precision(6);
    solve();    
    return 0;   
}
 
const int MOD = 1e9 + 7, MAXN = 5e5 + 10, INF = 1e18 + 10, BASE = 37; 

void solve() {
    map<string, int> cnt;
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        string cur;
        cin >> cur;
        cnt[cur]++;
    }

    cout << "AC x " << cnt["AC"] << endl;
    cout << "WA x " << cnt["WA"] << endl;
    cout << "TLE x " << cnt["TLE"] << endl;
    cout << "RE x " << cnt["RE"] << endl;
}

Measured memory_bytes: 3632
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()

if S <= '2019/04/30':
    print('Heisei')
else:
    print('TBD')
    


Measured memory_bytes: 13432
if __name__ == '__main__':
    N = int(input()) #1行目のNを取得する
    minv = int(input())
    maxv = 10**9*(-1)
    for j in range(N-1):
        r = int(input())
        if maxv < r-minv: maxv = r-minv
        if minv >r: minv = r
    print(str(maxv))


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)n-1; i >= 0; i--)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define RREP(i, a, n) for(int i = (int)(n)-1; i >= a; i--)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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

struct UnionFind {
    // 親ノードの番号を持つメンバ変数
    // ただし自分が親の時は-x(xは自身を含めた子ノードの数)
    vector<int> par;
    
    //　コンストラクタでの初期化1(初期値-1を持つn次元配列)
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    // 与えられたノードの親ノードの番号を返すメンバ関数
    int root(int x) {
        // もしも親ノードが0以下なら、それは初期値なので自身が親
        if (par[x] < 0) return x;
        // 親ノードを再帰的に一番上までたどって返す
        // 単にroot(par[x])ではなく代入してるのは、根に直接張り直すため
        else return par[x] = root(par[x]);
    }
    
    // もし根が同じかどうかの判定
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    // ２つの根をマージする処理
    bool unite(int x, int y) {
        // 根をたどって、同じなら何もしない
        x = root(x); y = root(y);
        if (x == y) return false;
 
        // xもyも今は親ノードなので、子の数を比べる
        if (par[x] > par[y]) swap(x, y); // merge technique
 
        // 小さい方を親ノードにする
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    // 親ノードに入っている番号*-1 = この木のノード数を返す。
    int size(int x) {
        return -par[root(x)];
    }
};

int main()
{
ll N, M;
    cin >> N >> M;
 
    vector<ll> A(M);
    vector<ll> B(M);
 
    rep(i, M){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
 
    vector<ll> ans;
    ll count = N*(N-1)/2;
 
    UnionFind uf(N);
 
    // 辺を1つずつ足していく
    rrep(i, M){
 
        // 現在の非連結ペアの数を格納
        ans.push_back(count);
 
        // 同じ木に属すなら処理終了
        if(uf.same(A[i], B[i])) continue;
 
        // 新たにくっついたときに連結できる様になるペアの数を数える
        ll pairs = uf.size(A[i]) * uf.size(B[i]);
 
        // 答えからペアの数を引く
        count -= pairs;
 
        //最後にマージ処理をする
        uf.unite(A[i], B[i]);
    }
 
    rrep(i, M){
        cout << ans[i] << endl;
    }
 
    return 0;
} 


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

using namespace std;

int N;

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

void solve() {
    if (N % findSumOfDigits(N) == 0) {
        printf("Yes");
    } else {
        printf("No");
    }
}

int main() {
    cin >> N;
    solve();
    return 0;
}

Measured memory_bytes: 3760
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}

ll dp[51][51][2501];
int main(){
  //dp[i][j][k]
  //i番目までj個使って合計k
  int N, A; cin >> N >> A;
  vector<int> x(N); rep(i,N) cin >> x[i];
  dp[0][0][0]=1;
  for(int i=1;i<=N;i++){
    for(int j=0;j<=i;j++){
      for(int k=0;k<=2500;k++){
        dp[i][j][k] += dp[i-1][j][k];
        if(k-x[i-1]>=0 && j) dp[i][j][k] += dp[i-1][j-1][k-x[i-1]];
      }
    }
  }
  ll ans = 0;
  for(int j=1;j<=N;j++){
    ans += dp[N][j][A*j];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 49152
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,a,b=LI()

  ab=a+b
  c=n//ab

  return c*a+min(n%ab,a)

# main()
print(main())


Measured memory_bytes: 5716
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;

int main() {

    int s;
    cin >> s;

    vector<int> a;
    a.push_back(s);

    for (int i = 0; i <= 1000000; ++i) {
        int num = a[i];
        if (num % 2 == 0) {
            int n = num / 2;

            auto result = find(a.begin(), a.end(), n);
            if (result == a.end()) {
                // not found
                a.push_back(n);
            } else {
                cout << i + 2 << endl;
                return 0;
            }

        } else {
            int n = 3 * num + 1;

            auto result = find(a.begin(), a.end(), n);
            if (result == a.end()) {
                // not found
                a.push_back(n);
            } else {
                cout << i + 2 << endl;
                return 0;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	a := s[0:1]
	b := s[1:2]
	c := s[2:3]
	res := 0
	if a == "R"|| b == "R"|| c == "R" {
		res = 1
	}
	if a == "R" && b == "R"{
		res = 2
	}
	if b == "R" && c == "R"{
		res = 2
	}
	
	if a == "R" && a == b && a == c{
		res = 3
	}

	fmt.Println(res)


}


Measured memory_bytes: 1772
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N, A, ans=5, low=1e15;
  cin >> N;
  for(int i=0; i<5; i++){
    long long A;
    cin >> A;
    low=min(low, A);
  }
  if(low<N){
    if(N%low!=0) ans++;
    ans+=N/low-1;  
  }
  cout << ans << endl;
}

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

// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>

vector <ll> v;

ll fep(ll x, ll y, ll mod)
{ll res=1;while(y>0){if(y&1)res=(res*x)%mod;
    y=y>>1;x=(x*x)%mod;}return res%mod;}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	//freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

	ll n,i,m,j,k,x,y,a,b,t;
	string s;
	
	cin >> s;
	n=s.size();
	x=0;
	for(i=0;i<n;i++)
		x=(x+s[i]-'0')%9;
	if(x)
		cout << "No\n";
	else
		cout << "Yes\n";

	return 0;
}


Measured memory_bytes: 3688
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, R):
    if N >= 10:
        return R
    return R + (100 *(10-N))


def main():
    N, R = read_int_n()
    print(slv(N, R))


if __name__ == '__main__':
    main()


Measured memory_bytes: 6468
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long K;
        K = sc.nextLong();
        String S;
        S = sc.next();

        final Solver solver = new Solver();
        solver.solve(N, K, S);
    }
}

class Solver {
    public void solve(long N, long K, String S) {
        int target = (int) (K - 1);
        for (int i = 0; i < N; i++) {
            if (i == target) {
                char n = (char) (S.charAt(target) - ('A' - 'a'));
                System.out.print(n);
                continue;
            }
            System.out.print(S.charAt(i));
        }
        System.out.println();
    }
}



Measured memory_bytes: 20692
import sys
sys.setrecursionlimit(100000)


class UnionFind():
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] != x:
            self.par[x] = self.find(self.par[x]) # contraction
        return self.par[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if not self.same(x, y):
            self.size[y] += self.size[x]
        self.par[x] = y

    def same(self, x, y):
        return self.find(x) == self.find(y)


n, m = map(int, input().split())
edge = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(m)]

uf = UnionFind(n)
ans = n * (n-1) // 2
anss = []
for i in reversed(range(m)):
    anss.append(ans)
    # print(uf.par)
    # print(uf.size, [uf.size[uf.find(i)] for i in range(n)])
    a, b = edge[i]
    if not uf.same(a, b):
        ans -= uf.size[uf.find(a)] * uf.size[uf.find(b)]
    # print(i, a, b)

    uf.unite(a, b)

for i in reversed(range(m)):
    print(anss[i])


Measured memory_bytes: 46344
from collections import Counter

_ = int(input())
A = list(map(int, input().split()))
a_max = 10 ** 6

c = Counter(A)
b = list(set(A))
b.sort()

dp = [True] * (a_max + 1)
ans = 0
for a in b:
    if dp[a]:
        if c[a] == 1:
            ans += 1
        for i in range(2 * a, a_max + 1, a):
            dp[i] = False

print(ans)

Measured memory_bytes: 158560
#include <iostream>
#include <string>
// #include <vector>
// #include <set>
// #include <queue>
// #include <stack>
// #include <algorithm>

using namespace std;


int main(){
    string s;
    cin >> s;
    if (s=="ARC") cout << "ABC";
    else cout << "ARC";
    return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll n,m,ans=0;
    cin>>n>>m;
    priority_queue<ll,vector<ll>>que;
    for(int i=0;i<n;i++){
        ll tmp;
        cin>>tmp;
        que.push(tmp);
    }
    for(int i=0;i<m;i++){
        ll tmp=que.top();
        que.pop();
        que.push(tmp/2);
    }
    while(!que.empty()){
        ans+=que.top();
        que.pop();
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
int main() {
  char a,b;
  cin>>a>>b;
  if(a=='H'){
    if(b=='H')	cout<<'H'<<endl;
    else	cout<<'D'<<endl;
  }else{
    if(b=='H')	cout<<'D'<<endl;
    else	cout<<'H'<<endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repb(i, n) for (int i = (n-1); i >= 0; i--)
#define rea(i, a, b) for (int i = (a); i < (b); i++)
#define reab(i, a, b) for (int i = (a)-1; i >= (b); i--)
#define ALL(a) (a).begin(),(a).end()
#define SZ(x) ((int)(x).size())
#define PRINT(V) for (auto v:(V)) {cerr << v << " ";} cerr << endl
#define dump(x) cerr << #x << " : " << (x) << endl
#define dump2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl
inline ll GCD(ll a, ll b){return b ? GCD(b, a % b) : a;}
const int MOD = 1000000007;
/* END OF TEMPLATE */

struct UnionFind{
    // par[i] parent. if i == par[i] i is root
    vector<ll> par;
    // sizes[i] sizeof tree i if i is root
    vector<ll> sizes;

    UnionFind(ll n) : par(n), sizes(n, 1){
        // init: all node is root i
        rep(i, n) par[i] = i;
    }

    // find root of x
    ll find(ll x){
        if (x == par[x])
            return x;
        return par[x] = find(par[x]); // recursive, editing root
    }

    // merge x, y
    void unite(ll x, ll y){
        // root
        x = find(x);
        y = find(y);

        // do not merge if same tree
        if (x == y)
            return;

        // force size x > y
        if (sizes[x] < sizes[y])
            swap(x, y);

        // unite: x is parent of y
        par[y] = x;
        sizes[x] += sizes[y];
    }

    // x, y same root
    bool same(ll x, ll y){
        return find(x) == find(y);
    }

    // size of tree containing x
    ll size(ll x){
        return sizes[find(x)];
    }
};

int main(){
    ll N, M;
    cin >> N >> M;
    UnionFind uf(N);
    vll X(M), Y(M), Z(M);
    ll ans = N;
    rep(i, M){
        cin >> X[i] >> Y[i] >> Z[i];
        if(!uf.same(X[i], Y[i])) ans--;
        uf.unite(X[i], Y[i]);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4224
#include <cstdio>
#include <set>
#define mp make_pair
#define FR first
#define SE second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=100010;
int n;
int a[N][2];
set<pii> l,r;
inline ll max(ll x,ll y){
	return x>y?x:y;
}
void readData(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&a[i][0],&a[i][1]);
	a[n+1][0]=0; a[n+1][1]=0;
}
void addseg(int i){
	l.insert(mp(a[i][0],i));
	r.insert(mp(a[i][1],i));
}
void remseg(int i){
	l.erase(l.find(mp(a[i][0],i)));
	r.erase(r.find(mp(a[i][1],i)));
}
void initSet(){
	for(int i=1;i<=n;i++)
		addseg(i);
}
void move(int &cur,ll &sum,int t){
	if(a[t][0]<=cur&&cur<=a[t][1])
		return;
	else if(cur<a[t][0]){
		sum+=a[t][0]-cur;
		cur=a[t][0];
	}
	else{
		sum+=cur-a[t][1];
		cur=a[t][1];
	}
}
void goleft(int &cur,ll &sum){
	static set<pii>::iterator it;
	it=r.begin();	
	int id=(*it).SE;
	move(cur,sum,id);
	remseg(id);
}
void goright(int &cur,ll &sum){
	static set<pii>::iterator it;
	it=l.end();
	it--;
	int id=(*it).SE;
	move(cur,sum,id);
	remseg(id);
}
ll solve(int f){
	ll res=0;
	int cur=0;
	initSet();
	for(int i=1;i<=n;i++)
		if(i&1^f)
			goleft(cur,res);
		else
			goright(cur,res);
	move(cur,res,n+1);
	return res;
}
int main(){
	readData();
	printf("%lld\n",max(solve(0),solve(1)));
	return 0;
}

Measured memory_bytes: 12416
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int, P>PP;
int v[100006];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> v[i];
	int sum = -n*(n + 1) / 2;
	rep(i, n)sum += v[i];
	cout << sum << endl;
}


Measured memory_bytes: 3880
#include"bits/stdc++.h"
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	string a, b;
  	cin >> a >> b;
  	if(a == b) puts("EQUAL");
  	else if(a.size() > b.size()) puts("GREATER");
  	else if(a.size() < b.size()) puts("LESS");
  	else if(a>b) puts("GREATER");
  	else puts("LESS");
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static readonly int mod = 1000000007;  // 10^9+7

		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			//int n = int.Parse(Console.ReadLine());
			//string s = Console.ReadLine();
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] a = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int ans = 0;
			for (int i = m / n; i > 0; i--) {
				if (m % i == 0) {
					//System.Diagnostics.Debug.WriteLine($"{m} / {i} = {m / i} >= {n}");
					if (m / i >= n) {
						ans = i;
						break;
					}
				}
			}
			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include <stdio.h>
#include <stdlib.h>
int main(void){
    long long x, k, d, ans, run;
    scanf("%lld%lld%lld", &x, &k, &d);
    x=llabs(x);
    run = (k<x/d ? k:x/d);
    k -= run;
    x -= run*d;
    if(k%2==0) ans = x;
    else ans = llabs(x-d);
    printf("%lld", ans);
    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h> 
using namespace std; 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = a; i <b; i++)
#define forn(i,a,b) for (int i = a; i >b; i--)
#define mod 1000000007
#define multiple_testcases_t int t;cin>>t;while(t--){solve();}
#define single_testcase_t solve();
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


ll fact(ll n)
{
  if(n==0 || n==1)
  return 1;
  else
  return (n*fact(n-1)%mod)%mod;
}

int prime(ll n)
{
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      return 0;
    }
  }
  return 1;
}

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

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

int check_palin(string s)
{
  string str=s;
  reverse(str.begin(),str.end());
  if(str==s)
  return 1;
  else 
  return 0;
}

vector<ll> divisors(ll n)
{
  vector<ll> v;
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      if(i==n/i)
      v.PB(i);
      else
      v.PB(i),v.PB(n/i);
    }
  }
return v;
}

ll bin_expo(int x,int n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_expo(x*x,n/2);
    else                             //n is odd
        return x*bin_expo(x*x,(n-1)/2);
}

ll modular_expo(int x,int n,int M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return modular_expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*modular_expo((x*x)%M,(n-1)/2,M))%M;
}

ll kadane_algo(int a[],int n)
{
   ll max_so_far=0,max_ending_here=0;
   forp(i,0,n)
   {
     max_ending_here+=a[i];
     if(max_ending_here<0)
     max_ending_here=0;
     
     if(max_ending_here>max_so_far)
     max_so_far=max_ending_here;
   }

   return max_so_far;
}

// <----- Actual solve() function to print output -----> //
void solve()
{
  ll n,z=0,k=0;
  cin>>n;
  string s;
  int a[4]={0};
  forp(i,0,n)
  {
       cin>>s;
       if(s=="AC")
       a[0]++;
       else if(s=="WA")
       a[1]++;
       else if(s=="TLE")
       a[2]++;
       else if(s=="RE")
       a[3]++; 
  }
  cout<<"AC x "<<a[0]<<"\nWA x "<<a[1]<<"\nTLE x "<<a[2]<<"\nRE x "<<a[3];
  //cout<<"\n";      //if t>1 uncomment this
}

// MAIN function --------------------------------------------------------------------------//
int main()
{
    fast_io
    single_testcase_t   //Uncomment this if only single testcase & single answer to print
  //  multiple_testcases_t  //Uncomment this if t>1(t is given in question)(multiple testcases)      
return 0;
}
            
            
            
            

Measured memory_bytes: 3708
#include<iostream>
#include<vector>
#include<utility>

int partition(std::vector<int> &A,int p,int r){
    int j=p-1;
    int x=A[r-1];
    for(int i=p;i<r-1;i++){
        if(A[i]<=x){
            j++;
            std::swap(A[i],A[j]);
        }
    }
    std::swap(A[j+1],A[r-1]);
    return j+1;
}

int main(void){
    int n;
    std::cin>>n;
    std::vector<int> A(n);
    for(int i=0;i<n;i++)
        std::cin>>A[i];
    int q=partition(A,0,n);
    for(int i=0;i<n;i++){
        std::cout<<(i?" ":"")<<(i==q?"[":"")<<A[i]<<(i==q?"]":"");
    }
    std::cout<<std::endl;
    return 0;
}


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

S = input()

start_set = []
#0番目と1番目を決めてから進める
start_set.append("SS") 
start_set.append("SW")
start_set.append("WS")
start_set.append("WW")

def listed_goal_set(i):
    goal_set = []
    if S[i] == "o":
        goal_set.append("SSS")
        goal_set.append("WSW")
        goal_set.append("WWS")
        goal_set.append("SWW")
    else:
        goal_set.append("WSS")
        goal_set.append("SSW")
        goal_set.append("WWW")
        goal_set.append("SWS")
    return goal_set
    
goal_set1 = listed_goal_set(0)
goal_set2 = listed_goal_set(-1)
    
isok = False
for st in start_set:
    O = []
    O.append(st[0])
    O.append(st[1])
    for i in range(1,N-1):
        if O[i-1]=="S":
            if O[i]=="S": 
                if S[i]=="o":
                    O.append("S") #SSS
                else:
                    O.append("W") #SSW
            else:
                if S[i]=="o":
                    O.append("W") #SWW
                else:
                    O.append("S") #SWS
                
        if O[i-1]=="W":
            if O[i]=="S":
                if S[i]=="o":
                    O.append("W") #WSW
                else:
                    O.append("S") #WSS
            else:
                if S[i]=="o":
                    O.append("S") #WWS
                else:
                    O.append("W") #WWW
    #print(O)
    goals1 = O[-1]+O[0]+O[1]
    goals2 = O[-2]+O[-1]+O[0]
    if goals1 in goal_set1 and goals2 in goal_set2:
        isok = True
        break
                
if isok:
    print("".join(O))
else:
    print("-1")

Measured memory_bytes: 4428
#include <bits/stdc++.h>
#define ll long long
using namespace std;
string s[101];
map <string,ll> mp;
int main()
{
    ll f=1,n,m,i,j;
    cin>>n;
    cin>>s[1];
    mp[s[1]]=1;
    for(i=2;i<=n;i++)
    {
        cin>>s[i];
        if (mp[s[i]]) f=0;
        else mp[s[i]]=1;
        if (s[i-1][s[i-1].size()-1]!=s[i][0])
            f=0;
    }
    if (f) cout<<"Yes";
    else cout<<"No";
    return 0;
}


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

int main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.length(); i++) {
		if (i % 2 == 0) {
			if (s.at(i) == 'L') {
				cout << "No" << endl;
				return 0;
			}
		}
		else {
			if (s.at(i) == 'R') {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
}

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

using namespace std;

void Main() {
    string s;
    cin >> s;
    s[5] = ' ';
    s[13] = ' ';
    cout << s << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


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



int main() 
{
  ll N; cin>>N;
  vector<bool> vecp(N,false);
  rep(i,N)
  {
    ll p; cin>>p;
    if(p==i+1) {vecp.at(i)=true;}
  }
  /*rep(i,N)
  {
    if(i!=0) {cout<<" ";}
    if(vecp.at(i)) {cout<<1; continue;}
    cout<<0;
  } */ 
  ll count=0;
  rep(i,N)
  {
    if(vecp.at(i)) {count++; i++;}
  }
  cout<<count<<endl;
  return 0;
}

Measured memory_bytes: 384
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力
static long long slA, slB, slC, slK;

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i;
	char lc1Buf[1024];

	// 値 - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%lld%lld%lld%lld", &slA, &slB, &slC, &slK);

	// ２回実行
	long long ll1Ans[2];
	for (i = 0; i < 2; i++) {
		ll1Ans[i] = slA - slB;

		// 和
		long long llA = slB + slC;
		long long llB = slC + slA;
		long long llC = slA + slB;
		slA = llA;
		slB = llB;
		slC = llC;
	}

	return (int)ll1Ans[slK % 2];
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// １行出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

int main (){
	string s, t; cin >> s;
	int n = s.size();
	for( int i = 0; i < n; i++ ){
		if( i % 2 == 0 ) t.push_back(s[i]);
	}
	cout << t << endl;
}

Measured memory_bytes: 512
N = int(input())
points = [list(map(int, input().split(" "))) for _ in range(N)]
points.insert(0, [0, 0, 0])

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = points[i + 1][0] - points[i][0]
    dist = abs(points[i + 1][1] - points[i][1]) + abs(points[i + 1][2] - points[i][2])
    if dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

if can:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 27324
N,K=map(int,input().split())
a=[0]*N
A=list(map(int,input().split()))
s=set(A)
if len(s)<=K: print(0)
else:
  for i in range(N):
    a[A[i]-1]+=1
  a.sort()
  ans=0
  for i in range(N):
    if N-i<=K:
      print(ans)
      break
    ans+=a[i]

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

#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define NL cout<<"\n";
#define test cerr<<"abcd\n";

int main() {
	sp;

	////////////////To Remove//////////////
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	///////////////////////////////////////
	string s;
	cin>>s;
	int n = s.length();
	vector<int> lps(n, 0);
	int i = 0, j=1;

	while(j < n){
		if(s[i] == s[j]){
			lps[j] = i+1;
			i++;
			j++; 
		}
		else{
			if(i==0){
				j++;
				continue;
			}
			i = lps[i-1];
		}
	}

	if(lps[n-1] >= n/2) cout<<"Yes";
	else cout<<"No";

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<s32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define fi first
#define se second
#define ln '\n'
#define debug(x) cout << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

int main()
{
	FASTIO;
	int n;
	cin >> n;
	v32 a(n, 0);
	int sum = 0;
	for (int i = 0; i < n; i++)
		cin >> a[i], sum += a[i];
	int ans = 0;
	for (int i = 0; i < n; i++)
		ans += a[i] * (sum - a[i]), sum -= a[i];
	cout << ans << ln;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)


 {
    int data[10] ;
    int i ,j;
    for (i = 0; i<= 9;i++){
    scanf("%d",&data[i]); /* ??\?????¨??????*/
      }
    for (i = 0; i<= 8;i++){
    for (j = 1; j<= 9-i;j++){
     if (data[i]<data[i+j]){
	int b ;
       b = data[i] ;
	data[i] = data[i+j] ;
	data[i+j] = b ;
		}
	 
		}
    	 
	}
     printf("%d\n%d\n%d\n",data[0],data[1],data[2]);
  
 return 0;
}
   

Measured memory_bytes: 600
n,m = map(int,input().split())
mi = 1
ma = 100000
for i in range(m):
    l,r = map(int,input().split())
    if l > mi:
        mi = l
    if r < ma:
        ma = r
if ma -mi < 0:
    print(0)
else:    
    print(ma-mi + 1)

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

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

    ll a, b, c, k;
    cin >> a >> b >> c >> k;

    ll diff = a - b;
    if (k % 2 == 1) {
        cout << diff*(-1);
    } else {
        cout << diff;
    }

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n"
typedef long long ll;
int main(){
    // ios::sync_with_stdio(false);
    // cin.tie(NULL);
    map<int, int> m;
    set<int> s;
    int a, b, c;
    cin >> a >> b >> c;
    s.insert(a); 
    s.insert(b);
    s.insert(c);
    cout << s.size() << "\n";
    bye;
}

Measured memory_bytes: 256
// Why am I so dumb? :c
#include <bits/stdc++.h>

#define pb push_back
#define mp make_pair

#define all(x) (x).begin(), (x).end()

#define fi first
#define se second

using namespace std;

typedef long long ll;

map<string, int> S[20];

int pw[20];

char s[45];

ll ans;

int n;

void pre() {
    pw[0] = 1;

    for (int i = 1; i < 20; ++i) {
        pw[i] = (pw[i - 1] << 1);
    }
}

bool bit(int m, int p) {
    return m & pw[p];
}

void solve() {
    scanf("%d %s", &n, s);
    string a, b;

    for (int m = 0; m < pw[n]; ++m) {
        a.clear();
        b.clear();

        for (int i = 0; i < n; ++i) {
            if (bit(m, i)) {
                a += s[n + i];
            }
            else {
                b += s[n + i];
            }
        }

        reverse(all(b));
        ++S[b.size()][b + a];
    }

    for (int m = 0; m < pw[n]; ++m) {
        a.clear();
        b.clear();

        for (int i = 0; i < n; ++i) {
            if (bit(m, i)) {
                a += s[i];
            }
            else {
                b += s[i];
            }
        }

        reverse(all(b));

        auto it = S[n - b.size()].find(a + b);

        if (it != S[n - b.size()].end()) {
            ans += (it -> se);
        }
    }

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

int main() {
    int tt = 1;

    pre();

    while (tt--) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 33024
import java.util.Scanner;
import java.util.Arrays;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long[] a = new long[3];
        a[0] = sc.nextLong();
        a[1] = sc.nextLong();
        a[2] = sc.nextLong();
		sc.close();
		if(a[0]%2==1 && a[1]%2==1 && a[2]%2==1){
            Arrays.sort(a);
            System.out.println(a[0]*a[1]);
        }else{
        	System.out.println("0");
        }
	}
}


Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define MAXN 200 + 5
const long long INF = 1LL << 60;
const int inf = 1 << 30;

void printVec(std::vector<int> &vec) {
  std::cout << "";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    std::cout << *it << " ";
  }
  std::cout << std::endl;
}
 
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; }

long long  mod = 1e9 + 7;

int main(){
  long long x; cin >> x;
  long long ans = 0;
  ans += 1000 * (x / 500);
  x = x - 500 * (x / 500);
  ans += 5 * (x / 5);
  cout << ans << endl;
}
     


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))

M = max(A) + 1
B = [0] * M
for a in A:
    B[a] += 1
l = [0] * M
for i in range(M):
    l[i] = B[i] * (B[i] - 1) // 2
ans = sum(l)
for a in A:
    if a == 0:
        print(ans)
    else:
        print(ans - l[a] + ((B[a] - 1) * (B[a] - 2) // 2))


Measured memory_bytes: 24748
#include <iostream>
#include <vector>
#include <iterator>
#define rep(i, cc, n) for (long long i = cc; i <= n; ++i)
using ll = long long;
using namespace std;

int main()
{
    ll N, Y;
    cin >> N >> Y;

    rep(i, 0, N)
    {
        rep(j, 0, N - i)
        {
            if (10000 * i + 5000 * j + 1000 * (N - i - j) == Y && N - i - j >= 0)
            {
                cout << i << " " << j << " " << N - i - j << endl;
                return 0;
            }
        }
    }

    cout << "-1 -1 -1";
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define ALL(v) (v).begin(), (v).end()
#define REV(s) (s).rbegin(), (s).rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main(){
	int n;
	cin >> n;
	while(n--){
		int x, y, b, p;
		cin >> x >> y >> b >> p;
		cout << min(x*b+y*p, (x*max(b, 5)+y*max(p, 2))/5*4) << endl;
	}

	return 0;
}

Measured memory_bytes: 1164
#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
//#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

void func(void)
{
//DEBUG_OUT("----\n");
    int R, G;
    cin >> R;
    cin >> G;

    cout << (2*G-R) << endl;
    
    return;
}



Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        sc.close();

        // 主処理
        Set<String> set = new HashSet<>(Arrays.asList(s.split("")));

        boolean judge = s.length() == set.size();
        String result = judge ? "yes" : "no";

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<climits>
#include<queue>
#include<stack>
#include<numeric>
#include<set>
#include<iomanip>
#include<map>
#include<type_traits>
#include<tuple>
#include<deque>
#include<cassert>
using namespace std;
typedef long long ll;
typedef pair<ll,int> p;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const int INF = 1001001001;

int main() {
  int x;
  cin >> x;
  int ans = 1;
  for (int i = 2; i * i <= x; ++i) {
    for(int j = 2; ; ++j) {
      int p = pow(i, j);
      if(p > x) break;
      ans = max(ans, p);
    }
  }
  cout << ans << endl;
}


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n,k;

	cin>>n>>k;

	vector<lli> p(n);
	vector<double> q(n);
	REP(i,0,n){
		cin>>p[i];
		q[i] = (p[i]+1)/(double)2;
	}
	double sum=0;
	double ans=0;

	REP(i,0,k)sum += q[i];
	ans = max(ans,sum);

	REP(i,k,n){
		sum -= q[i-k];
		sum += q[i];
		ans = max(ans,sum);
	}

	cout<<setprecision(15);
	cout<<ans<<endl;


	return 0;
}

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

int main() {
    int a, b;
    cin >> a >> b;
    if(a == b){
        cout << "a == b" << endl;
    } else {
        cout << "a " << ((a < b) ? "<" : ">") << " b" << endl;
    }

    return 0;
}

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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz:" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    auto b = a;
    b.erase(unique(b.begin(), b.end()), b.end());
    ll ans = 0;
    for (const ll e : b) {
        const int num = upper_bound(a.begin(), a.end(), e) - lower_bound(a.begin(), a.end(), e);
        if (num < e) {
            ans += num;
        } else {
            ans += max(0LL, num - e);
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
//shara's here
#include <bits/stdc++.h>
using namespace std;
typedef int q;
typedef double w;
typedef string s;
typedef long long ll;
int main(){
    ll a,b,c;
    cin>>a;
    if(a==1){cout<<"Hello World";}
    else if(a==2){cin>>b>>c;
    cout<<b+c;
     }
return 0;}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}
vector<bool> seen;
void dfs(const vector<vector<int>> &G, int v) {
    seen[v] = true; // v を訪問済にする

    // v から行ける各頂点 next_v について
    for (auto next_v : G[v]) {
        if (seen[next_v]) continue; // next_v が探索済だったらスルー
        dfs(G, next_v); // 再帰的に探索
    }
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N,M;
    cin >> N >> M;
    vector<vector<int>> graph(N+M,vector<int>(0));
    REP(i,N){
        int kaisuu;
        cin >> kaisuu;
        REP(a,kaisuu){
            int lang;
            cin >> lang;
            graph[i].pb(lang + N-1);
            graph[lang + N-1].pb(i);
        }
    }
    // 頂点 s をスタートとした探索
    seen.assign(N+M, false); // 全頂点を「未訪問」に初期化
    dfs(graph, 0);
    bool ok = 1;
    REP(i,N){
        if(!seen[i])ok = 0;
    }
    cout << (ok ? "YES" : "NO") << "\n";
}

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

int main(){

    int N,Q;
    string S;
    cin>>N>>Q>>S;
    vector<int> C(N);
    for(int i=1;i<N;i++){
        if(S.at(i-1)=='A'&&S.at(i)=='C'){
            C.at(i)=C.at(i-1)+1;
        }
        else C.at(i)=C.at(i-1);
        }

    for(int i=0;i<Q;i++){
        int l,r,cnt=0;
        cin>>l>>r;
        cout<<C.at(r-1)-C.at(l-1)<<endl;
    }
}
    


Measured memory_bytes: 1408