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


//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    LL n,k;
    LL nn;
    cin >> n >> k;
    if(n % k == 0){
        cout << 0 << endl;
    }else{
        n = n % k;
        REP(i,5){
            nn = abs(n - k);
            if(nn < n) n = nn;
        }
        cout << n << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> a(2*n);
    for(int i = 0; i < 2*n; i++)
    {
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0; i < n; i++)
    {
        int sum = 0;
        for(int j = 0; j <= i; j++)
        {
            sum += a[j];
        }
        for(int k = i; k < n; k++)
        {
            sum += a[k+n];
        }
        ans = max(ans, sum);
    }
    cout << ans << endl;
}

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

using namespace std;

int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int a,b,c;

    scanf("%d%d%d",&a,&b,&c);

    int sum = a+b+c;

    if(sum>=22){
        printf("bust\n");
    }
    else printf("win");

    return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:

set<int> s;

int main(void){
	int n;
	cin >> n;
	s.insert(-1),s.insert(n);

	using pii=pair<int,int>;
	vector<pii> ary(n);
	rep(i,n){
		cin >> ary[i].first;
		ary[i].second=i;
	}

	sort(_all(ary));

	ll ans=0LL;

	rep(i,n){
		auto ub=s.lower_bound(ary[i].second);
		auto lb=ub;lb--;

		const int idx=ary[i].second;

		ll lft=(idx-*lb),rgt=(*ub-idx);
		//cout << lft << " " << rgt << endl;
		ans+=1LL*lft*rgt*ary[i].first;
		s.insert(ary[i].second);
	}

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

Measured memory_bytes: 11136
(n,),a=$<.map{|s|s.split.map &:to_i}
d=[0]*(n+1)
e=[0]*(n+1)
d[0]=0
e[0]=-10**10
n.times{|i|
d[i+1]=[d[i]+a[i],e[i]-a[i]].max
e[i+1]=[d[i]-a[i],e[i]+a[i]].max
}
p d.last

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int C = 0, D = 0;
    for (int i = 0; i < N; i++) {
        int A, B; cin >> A >> B;
        if (A == B) C++;
        else C = 0;
        D = max(C, D);
    }
    if (D >= 3) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
        int h,m,s,S;
        scanf("%d",&S);
        
        h=S/3600;
        m=S%3600/60;
        s=S%3600%60;
        
        printf("%d:%d:%d\n",h,m,s);
        
        return 0;
}



Measured memory_bytes: 2120
#include <bits/stdc++.h>
#define ri register
#define int long long
#define E (n+1)
using namespace std; const int N=200010;
inline int read()
{
    int s=0, w=1; ri char ch=getchar();
    while(ch<'0'||ch>'9') { if(ch=='-') w=-1; ch=getchar(); }
    while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48), ch=getchar();
    return s*w;
}
signed main()
{
    string s;
    cin>>s;
    for(ri int i=0;i<(1<<3);i++)
    {
        int qwq=0;
        qwq=s[0]-'0';
        for(ri int j=0;j<3;j++)
        {
            if((i>>j)&1ll) qwq+=s[j+1]-'0';
            else qwq-=s[j+1]-'0';
        }
        if(qwq==7)
        {
            cout<<s[0];
            for(ri int j=0;j<3;j++)
            {
                if((i>>j)&1ll) cout<<'+';
                else cout<<'-';
                cout<<s[j+1];
            }
            puts("=7");
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3568
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin, (v).end);


typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int N;
    


    //入力
    cin >> N;

    cout << N*N*N;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
static const int dx[4] = { 0, 1, 0, -1 };
static const int dy[4] = { 1, 0, -1, 0 };
static const char dir[4] = { 'u', 'r', 'd', 'l' };
static const ll INF = 1 << 21;
static const ll MOD = 1e9 + 7;
class SuffixArray {
private:
    int n;
    vector<int> rank;
public:
    string s;
    vector<int> idx;
    SuffixArray(string& s)
        : n(s.size())
        , rank(s.size() + 1)
        , s(s)
        , idx(s.size() + 1)
    {
        rep(i, n + 1)
        {
            idx[i] = i;
            rank[i] = i < n ? s[i] : -1;
        }
        int k;
        auto comp = [&](const int i, const int j) -> bool {
            if (rank[i] != rank[j]) {
                return rank[i] < rank[j];
            } else {
                int ri = i + k <= n ? rank[i + k] : -1;
                int rj = j + k <= n ? rank[j + k] : -1;
                return ri < rj;
            }
        };

        vector<int> tmp(n + 1);
        for (k = 1; k <= n; k *= 2) {
            sort(idx.begin(), idx.end(), comp);

            tmp[idx[0]] = 0;
            for (int i = 1; i < n + 1; i++) {
                tmp[idx[i]] = tmp[idx[i - 1]] + (comp(idx[i - 1], idx[i]) ? 1 : 0);
            }
            rank = tmp;
        }
    }
    bool contain(string& t)
    {
        int right = n, left = 0;
        while (right - left > 1) {
            int mid = (right + left) / 2;
            if (s.substr(idx[mid], t.size()) < t) {
                left = mid;
            } else {
                right = mid;
            }
        }
        return s.substr(idx[right], t.size()) == t;
    }
};

int main()
{
    string T;
    int Q;
    cin >> T >> Q;

    SuffixArray suf(T);
    rep(i, Q)
    {
        string P;
        cin >> P;
        cout << suf.contain(P) << endl;
    }
    return 0;
}


Measured memory_bytes: 16596
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pii>
#define read(FILE)  freopen(FILE, "r", stdin);
#define out(FILE) freopen(FILE, "w", stdout);
#define clr(x, y) memset(x,y,sizeof(x));
#define IO ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(),x.end()
#define rep(i, m, n) for(int i=m ; i<n ; i++)
#define forr(i, m, n) for(int i=m ; i<=n ; i++)
#define endl '\n'
#define pb push_back
#define re return
const int N = 2e5 + 2;
const int OO = 1e9 + 7;
using namespace std;
int main() {
    IO;
    int n,a[N]; cin>>n;
    map<ll,ll>freq;
    rep(i,0,n){
        cin>>a[i];
        freq[a[i]]++;
    }
    ll sum=0;
    for(auto i:freq){
        sum+=(i.S*(i.S-1)/2);
    }
    //cout<<sum<<endl;
    rep(i,0,n){
        cout<<sum-(freq[a[i]]-1)<<endl;
    }


}


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

using namespace std;

int main()
{
    int x;
    cin >> x;
    if (x < 600) {
        cout << 8 << endl;
    } else if (x < 800) {
        cout << 7 << endl;
    } else if (x < 1000) {
        cout << 6 << endl;
    } else if (x < 1200) {
        cout << 5 << endl;
    } else if (x < 1400) {
        cout << 4 << endl;
    } else if (x < 1600) {
        cout << 3 << endl;
    } else if (x < 1800) {
        cout << 2 << endl;
    } else {
        cout << 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 3632
puts "1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51".split(", ")[$stdin.readline().to_i - 1]


Measured memory_bytes: 1788
# -*- coding: utf-8 -*-
"""
C - Triangular Relationship
https://atcoder.jp/contests/abc108/tasks/arc102_a

"""
import sys


def solve(N, K):
    if K == 1:
        return N**3
    if K % 2:
        return (N // K)**3
    res1 = sum([i%K == 0 for i in range(1, N+1)])
    res2 = sum([i%K == K//2 for i in range(1, N+1)])
    return res1**3 + res2**3


def main(args):
    N, K = map(int, input().split())
    ans = solve(N, K)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


Measured memory_bytes: 4632
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
s = input()
if s[:n // 2] == s[n // 2:]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include <stdio.h>
#include <stdlib.h>
int main(){
  int i, j, k,length, key, *A;
  scanf("%d",&length);
  A = (int *)malloc(sizeof(int) * length);
  for(j=0; j<length; j++)
    scanf("%d",&A[j]);
  for(i=0; i<length; i++){
    key = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > key){
      A[j+1] = A[j];
      j--;
      A[j+1] = key;
    }
    for(k=0; k<length; k++){
      printf("%d",A[k]);
      if(k+1 < length)
	printf(" ");
    }
      printf("\n");
  }
  return 0;
}

Measured memory_bytes: 604
import java.util.*;
 
class Main{
  public static void main(String[] args){
    Scanner scanner=new Scanner(System.in);
    String way=scanner.next();
    String[] tap=way.split("");
    String Ans="Yes";
    for(int a=0;a<tap.length;a+=2){
      if(!(tap[a].equals("R")) && !(tap[a].equals("U")) && !(tap[a].equals("D"))){
        if(Ans.equals("Yes")){
          Ans="No";
        }
      }
    }
    for(int a=1;a<tap.length;a+=2){
      if(!(tap[a].equals("L")) && !(tap[a].equals("U")) && !(tap[a].equals("D"))){
        if(Ans.equals("Yes")){
          Ans="No";
        }
      }
    }
    System.out.println(Ans);
  }
}

Measured memory_bytes: 23764
N = int(input())
A = [0]+[int(X) for X in input().split()]+[0]
Cost = sum(abs(A[T+1]-A[T]) for T in range(N+1))
for T in range(1,N+1):
    Cut = Cost+abs(A[T+1]-A[T-1])-abs(A[T]-A[T-1])-abs(A[T+1]-A[T])
    print(Cut)

Measured memory_bytes: 20624
from collections import defaultdict

N = int(input())
A = [input() for _ in range(N)]
A.sort()
d = defaultdict(int)
for a in A:
    d[a] += 1

l = sorted(d.items())
max_v = 0

for _, v in l:
    if v > max_v:
        max_v = v
    
for k, v in l:
    if v == max_v:
        print(k)
    else:
        continue


Measured memory_bytes: 46132
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
template <class T>
using ordered_multiset = __gnu_pbds::tree<T, __gnu_pbds::null_type, less_equal<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

#define PI atan2(0, -1)
#define EPS 1e-9
#define INF 5e18
#define MOD 1000000007

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

long long N, ret;

int main(){
    //freopen("sort.in", "r", stdin); freopen("sort.out", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(10);
    cin >> N;
    ret = (N*(N+1)*(N+2))/6;
    for(int i = 1; i < N; i++){
        long long x, y; cin >> x >> y;
        if(x > y) swap(x, y);
        ret -= x*(N-y+1);
    }
    cout << ret << '\n';
    return 0;
}

/******************************
Kateba ii dake no hanashi darou
Success is only a victory away
- No Game No Life Opening
******************************/

Measured memory_bytes: 3648
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

public class Program
{
	static public void Main(string[] args)
	{
		var data = ReadNums().ToList();
		var n = data[0];
		var k = data[1];
		var a = ReadNums().ToList();
		a.Sort();
		a.Reverse();
		var temp = a.Skip(k);
		decimal sum = 0;
		foreach(var v in temp)
		{
			sum += v;
		}

		Console.WriteLine(sum);

		Console.ReadKey();
		return;
	}
	static public IEnumerable<int> ReadNums()
	{
		return Console.ReadLine().Split(' ').Select(x => int.Parse(x));
	}
}

Measured memory_bytes: 33116
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define repP(i, a, b) for(int i = a; i < b; i++)
#define repM(i, a, b) for(int i = a - 1; i >= b; i--)

using namespace std;

int main()
{
  int a = 0 , b = 0, c = 0, d = 0, e = 0, f = 0, i = 0, j = 0;
  int num = 0, count = 0, ans = 0;
  double d1 = 0, d2 = 0, d3 = 0, d4 = 0, d5 = 0, d6 = 0;
  int a1[999999], a2[999999], a3[999999];
  //char s1[200000], s2[200000], s3[200000];
  //string s1, s2, s3;
  
  cin >> a;
  
  cout << a * a<< endl;
}
  


Measured memory_bytes: 256
H, W = map(int, input().split())
N = int(input())
A = list(map(int, input().split()))
res = [[-1 for _ in range(W)] for _ in range(H)]
tmp = []
for i in range(N):
    for j in range(A[i]):
        tmp.append(i + 1)
        
for i in range(H):
    result = ''
    for j in range(W):
        if i%2 == 0:
            result = result + str(tmp[W * i + j])
            if j != W - 1:
                result = result + ' '
        else:
            result =  str(tmp[W * i + j]) + result
            if j != W - 1:
                result = ' ' + result 
            
    print(result)
        

Measured memory_bytes: 3572
# -*- 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


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


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(N, K, AB):
    M = Mod(10**9+7)
    def P(n, k):
        ret = 1
        for i in range(n, n-k, -1):
            ret = M.mul(ret, i)
        return ret
    
    g = defaultdict(list)
    for a, b in AB:
        g[a].append(b)
        g[b].append(a)
    
    s = 1
    q = g[s][:]
    done = set([s]) | set(q)
    ans = K
    ans = M.mul(ans, P(K-1, len(g[s])))
    while q:
        u = q.pop()
        for v in g[u]:
            if v not in done:
                done.add(v)
                q.append(v)
        c = len(g[u])-1
        ans = M.mul(ans, P(K-2, c))
    return ans


def main():
    N, K = read_int_n()
    AB = [read_int_n() for _ in range(N-1)]
    print(slv(N, K, AB))


if __name__ == '__main__':
    main()


Measured memory_bytes: 52124
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 300005

// it's swapnil07 ;)


signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    int a, b;
    cin>>a>>b;
    int ans = max(a+b, a-b);
    ans = max(ans, a*b);
    cout<<ans;
    return 0;
}

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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in(), k = in();
    vint p = in(n);

    vll sum(n + 1, 0);
    rep(i, n) sum[i + 1] = sum[i] + p[i];

    ll ma = 0;
    ll l = 0;
    rep(i, n - k + 1)
    {
        ll tmp = sum[i + k] - sum[i];
        if (ma <= tmp)
        {
            ma = tmp;
            l = i;
        }
    }

    double ans = 0;
    for (int i = l; i < l + k; ++i)
    {
        ans += (p[i] + 1) / 2.;
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#include<iostream>
#include<vector>
#include<map>
#include<math.h>

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std;

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";}
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}

template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int n;
    cin >> n;
    
    map<string, int> mp;
    ll ans = 0;

    irep(i, n) {
        string s;
        cin >> s;
        sort(s.begin(), s.end());
        if(mp[s]) { 
            ans += mp[s];
        }
        mp[s]++;
    }
    cout << ans << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 11384
#include <iostream>
typedef long long ll;

using namespace std;

ll a, b, n;

int main()
{
	ios_base::sync_with_stdio(false);
	cin >> a >> b >> n;
	ll res;
	if (n < b) {
		res = a * n / b;
	}
	else {
		res = a * (b - 1) / b;
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3640
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
int N;
int A[200003];

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

  cin >> N;
  int a;
  rep(i, N) {
    cin >> a;
    a--;
    A[i] = a;
  }
  int idx = 0;
  rep(i, N) {
    if (A[i]==idx) {
      idx++;
    }
  }
  int ans = idx==0?-1:N-idx;
  cout << ans << "\n";
  return 0;
}

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

int main(){
	int n,m;
	cin>>n>>m;
	int degree[n+1] = {0};

	for(int i=0; i<m; i++){
		int a,b;
		cin>>a>>b;
		degree[a-1]+=1;
		degree[b-1]+=1;
	}

	for(int i=0; i<n; i++){
		cout<<degree[i]<<endl;
	}
}

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

using namespace std;

int main()
{
    int n, m, X, Y; cin >> n >> m >> X >> Y;
    vector<int> x;
    vector<int> y;
    x.push_back(X);
    y.push_back(Y);

    for (int i = 0; i < n; i++) {
        int xi; cin >> xi;
        x.push_back(xi);
    }
    for (int i = 0; i < m; i++) {
        int yi; cin >> yi;
        y.push_back(yi);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    if (*--x.end() < *y.begin()) {
        cout << "No War" << endl;
    } else {
        cout << "War" << endl;
    }

    return 0;
}

Measured memory_bytes: 888
n, k = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n - 1)]
mod = 10 ** 9 + 7

adj = [[] for _ in range(n + 1)]
for a, b in ab:
    adj[a].append(b)
    adj[b].append(a)

s = 1
p = [-1] * (n + 1)
p[0] = 0
p[1] = 0
c = [[] for _ in range(n + 1)]
order = []
stack = [s]
while stack:
    u = stack.pop()
    order.append(u)
    for v in adj[u]:
        if p[v] == -1:
            p[v] = u
            c[u].append(v)
            stack.append(v)

ans = k
for u in order:
    mx = k - 1
    par = p[u]
    if par:
        mx -= 1

    for i in range(len(c[u])):
        ans *= mx - i
        ans %= mod

print(ans)


Measured memory_bytes: 47940
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var nextReader func() string

func newScanner() func() string {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, 1024), int(1e11))
	sc.Split(bufio.ScanWords)
	return func() string {
		sc.Scan()
		return sc.Text()
	}
}

func nextString() string { return nextReader() }

func nextInt() int { n, _ := strconv.Atoi(nextReader()); return n }

func nextInts(size int) []int {
	ns := make([]int, size)
	for i := 0; i < size; i++ {
		ns[i] = nextInt()
	}
	return ns
}

type set struct {
	c int
	s string
}

type sets []set

func (ss sets) Len() int {
	return len(ss)
}

func (ss sets) Swap(i, j int) {
	ss[i], ss[j] = ss[j], ss[i]
}

func (ss sets) Less(i, j int) bool {
	if ss[i].c == ss[j].c {
		return ss[i].s < ss[j].s
	} else {
		return ss[i].c > ss[j].c
	}
}

func main() {
	nextReader = newScanner()
	N := nextInt()
	var S = make(map[string]int, N)
	for i := 0; i < N; i++ {
		S[nextString()] += 1
	}

	ss := sets{}
	for k, v := range S {
		e := set{v, k}
		ss = append(ss, e)
	}
	sort.Sort(ss)
	for i := 0; ss[i].c == ss[0].c; i++ {
		fmt.Println(ss[i].s)
		if i == len(ss)-1 {
			break
		}
	}
}


Measured memory_bytes: 33920
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef pair<double, double> pdd;
typedef pair<pii, int> ppi;

int N, A[100010], B[100010];
int chk[100010][2];
ll sum = 0;

ll get_max(multiset <int> &X, int b) {
	X.erase(X.find(b));
	ll save = *X.rbegin();
	X.insert(b);
	return save;
}

int main(){
	scanf("%d", &N);
	for(int i=1;i<=N;i++) scanf("%d%d", A+i, B+i);
	ll sa = 0, sb = 0;
	for(int i=1;i<=N;i++) sa += A[i], sb += B[i];
	ll ans = min(sa, sb);
	vector <pii> V;
	for(int i=1;i<=N;i++) {
		V.pb(pii(A[i], i));
		V.pb(pii(B[i], -i));
	}
	sort(all(V));
	multiset <int> X;
	for(int i=0;i<N;i++) {
		sum += V[i].Fi;
		X.insert(V[i].Fi);
		if(V[i].Se > 0) chk[V[i].Se][0] = 1;
		else chk[-V[i].Se][1] = 1;
	}
	for(int i=1;i<=N;i++) {
		if(chk[i][0] + chk[i][1] == 1) {
			if(chk[i][0] == 0) {
				ll tsum = sum + A[i] - get_max(X, B[i]);
				ans = min(ans, tsum);
			}
			else {
				ll tsum = sum + B[i] - get_max(X, A[i]);
				ans = min(ans, tsum);
			}
		}
		else if(chk[i][0] + chk[i][1] == 2) ans = min(ans, sum);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 8048
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define pb push_back
#define mp make_pair
#define to_s to_string
#define sz(v) (int)v.size()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )
#define pr(x) cout<<(x)<<'\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
using Edge = pair<int,long long>;
using Graph = vector<vector<Edge>>;
typedef pair<int,int> P;
struct aaa{aaa(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}aaaaaaa;
int MOD = 1e9 + 7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


int main(){
    int N;
    cin >> N;
    pr((N-1)/2);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define db(x) cout << (x) << '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pii;
typedef pair<double,ll> pdi;
typedef pair<string,ll> psi;
typedef pair<ll,string> pls;
typedef pair<ll,pii> pip;
typedef pair<pii,pii> ppp;
#define MAXN 100005
#define eps 1e-11

int xy[MAXN][2],n;
char d[MAXN];

ld ev(ld x)
{
    ld xa=-1e8,xi=1e8,ya=-1e8,yi=1e8;
    for(int i=0;i<n;i++)
    {
        ld bx=xy[i][0];
        ld by=xy[i][1];

        if(d[i]=='R')
            bx+=x;
        if(d[i]=='L')
            bx-=x;
        if(d[i]=='U')
            by+=x;
        if(d[i]=='D')
            by-=x;
        xa=max(xa,bx);
        xi=min(xi,bx);
        ya=max(ya,by);
        yi=min(yi,by);
    }
    return (xa-xi)*(ya-yi);
}

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

    cin >> n;
    int xa=-1e8,xi=1e8,ya=-1e8,yi=1e8;
    for(int i=0;i<n;i++)
    {
        cin >> xy[i][0] >> xy[i][1] >> d[i];
        xa=max(xa,xy[i][0]);
        xi=min(xi,xy[i][0]);
        ya=max(ya,xy[i][1]);
        yi=min(yi,xy[i][1]);
    }

    vector<ld> interesting;
    interesting.push_back(0);

    ld p1=-1e8;
    for(int i=0;i<n;i++)
        if(d[i]!='R' && d[i]!='L')
            p1=max(p1,(ld)xy[i][0]);
    interesting.push_back(xa-p1);

    p1=-1e8;
    for(int i=0;i<n;i++)
        if(d[i]=='R')
            p1=max(p1,(ld)xy[i][0]);
    if(p1!=xa)
    {
        if(interesting[interesting.size()-1]==0)
            interesting.push_back(xa-p1);
        else
            interesting.push_back(((ld)xa-p1)/2.0);
    }

    p1=1e8;
    for(int i=0;i<n;i++)
        if(d[i]!='R' && d[i]!='L')
            p1=min(p1,(ld)xy[i][0]);
    interesting.push_back(p1-xi);

    p1=1e8;
    for(int i=0;i<n;i++)
        if(d[i]=='L')
            p1=min(p1,(ld)xy[i][0]);
    if(p1!=xi)
    {
        if(interesting[interesting.size()-1]==0)
            interesting.push_back(p1-xi);
        else
            interesting.push_back(((ld)p1-xi)/2.0);
    }

    p1=-1e8;
    for(int i=0;i<n;i++)
        if(d[i]!='U' && d[i]!='D')
            p1=max(p1,(ld)xy[i][1]);
    interesting.push_back(ya-p1);

    p1=-1e8;
    for(int i=0;i<n;i++)
        if(d[i]=='U')
            p1=max(p1,(ld)xy[i][1]);
    if(p1!=ya)
    {
        if(interesting[interesting.size()-1]==0)
            interesting.push_back(ya-p1);
        else
            interesting.push_back(((ld)ya-p1)/2.0);
    }

    p1=1e8;
    for(int i=0;i<n;i++)
        if(d[i]!='U' && d[i]!='D')
            p1=min(p1,(ld)xy[i][1]);
    interesting.push_back(p1-yi);

    p1=1e8;
    for(int i=0;i<n;i++)
        if(d[i]=='D')
            p1=min(p1,(ld)xy[i][1]);
    if(p1!=yi)
    {
        if(interesting[interesting.size()-1]==0)
            interesting.push_back(p1-yi);
        else
            interesting.push_back(((ld)p1-yi)/2.0);
    }

    ld res=1e17;
    for(auto y : interesting)
        res=min(res,ev(y));

    cout.precision(12);
    cout<<fixed;

    db(res)

    return 0;
}
/**
5
-7 -10 U
7 -6 U
-8 7 D
-3 3 D
0 -6 R
**/

Measured memory_bytes: 1280
#include <cstdio>
#include <cstdlib>
//#include <cmath>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <list>
#include <queue>
#include <set>
using namespace std;

int main(void){

	char str1[50], str2[50];
	
	int n; cin >> n;

	for (int m = 0; m < n; m++){
		cin >> str1 >> str2;

		int len1 = strlen(str1);
		int len2 = strlen(str2);

		int num1 = 0, num2 = 0, buff = 1;

		for (int i = 0; i < len1; i++){
			switch (str1[i]){
			case 'm': num1 += buff * 1000;
				buff = 1;
				break;
			case 'c': num1 += buff * 100;
				buff = 1;
				break;
			case 'x': num1 += buff * 10;
				buff = 1;
				break;
			case 'i': num1 += buff;
				buff = 1;
				break;
			default: buff = str1[i] - '0';
			}
		}

		for (int i = 0; i < len2; i++){
			switch (str2[i]){
			case 'm': num2 += buff * 1000;
				buff = 1;
				break;
			case 'c': num2 += buff * 100;
				buff = 1;
				break;
			case 'x': num2 += buff * 10;
				buff = 1;
				break;
			case 'i': num2 += buff;
				buff = 1;
				break;
			default: buff = str2[i] - '0';
			}
		}

		//cout << "num1:" << num1 << endl;
		//cout << "num2:" << num2 << endl;

		int num = num1 + num2;

		switch (num / 1000){
		case 0: break;
		case 1: cout << 'm';
			break;
		default: cout << (num / 1000) << 'm';
		}

		switch ((num / 100) % 10){
		case 0: break;
		case 1: cout << 'c';
			break;
		default: cout << (num / 100) % 10 << 'c';
		}

		switch ((num / 10) % 10){
		case 0: break;
		case 1: cout << 'x';
			break;
		default: cout << (num / 10) % 10 << 'x';
		}

		switch (num % 10){
		case 0: break;
		case 1: cout << 'i';
			break;
		default: cout << num % 10 << 'i';
		}

		cout << endl;
	}

	return 0;
}

/*
for(i=0;i<N;i++){
cin >> X[i];
}


for(i=0;i<N;i++){
for(j=0;j<N;j++){
cin >> X[i][j];
}
}
*/

Measured memory_bytes: 1164
<?php
$N = intval(trim(fgets(STDIN)));
$A = array_map("intval", explode(" ", trim(fgets(STDIN))));
$B = array_map("intval", explode(" ", trim(fgets(STDIN))));
$dp = array_fill(0, 1<<$N, array_fill(0,51,PHP_INT_MAX));
$dp[0][0] = 0;
for($bit = 0, $NN = 1<<$N; $bit < $NN; ++$bit){
    $con = 0;

    $x = $bit;
    $x = $x - (($x >> 1) & 0x55555555);
    $x = ($x & 0x33333333) + (($x >> 2) & 0x33333333);
    $x = ($x + ($x >> 4)) & 0x0f0f0f0f;
    $x = $x + ($x >> 8);
    $x = $x + ($x >> 16);
    $con = $x & 0x0000003F;

    $ords = [];
    $iter = $con - 1;
    for($i = 0; $i < $N; ++$i)
        if(!($bit & (1<<$i)))
            $ords[$i] = ++$iter;
    for($s = 0; $s <= 50; ++$s){
        if($dp[$bit][$s] == PHP_INT_MAX)continue;
        foreach($ords as $p0 => $p1){
            $ns = ($p0-$con) & 1 ? $B[$p0] : $A[$p0];
            if($ns >= $s){
                $nb = $bit | (1<<$p0);
                $dp[$nb][$ns] = min($dp[$nb][$ns], $dp[$bit][$s] + abs($p1 - $con));
            }
        }
    }
}
$min = min($dp[(1<<$N)-1]);
if($min == PHP_INT_MAX){
    echo -1;
}else{
    echo $min;
}


Measured memory_bytes: 682488
A, B, C, X = [int(input()) for _ in range(4)]

count = 0

for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            com = 500*a + 100*b + 50*c
            if X == com:
                count += 1

print(count)

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

int main() {
	vector<int> car;
	int n;
	
	while ( cin >> n ) {
		if ( n ) {
			car.push_back ( n );
		} else {
			cout << car.back () << endl;
			car.pop_back ();
		}
	}
	
	return 0;
}

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

using namespace std;

long long inf=1000000007;

long long modpow(long long n,long long p,long long mod);

int main(){
	long long mo=modpow(10,6,inf);
	vector<long long> simen,kisu;
	long long hoge=1;
	while(hoge*(hoge+1)*(hoge+2)/6<=mo){
		simen.push_back(hoge*(hoge+1)*(hoge+2)/6);
		if(hoge*(hoge+1)*(hoge+2)/6%2==1) kisu.push_back(hoge*(hoge+1)*(hoge+2)/6);
		hoge++;
	}

	vector<long long> dp(mo+1,inf),kdp=dp;
	dp.at(0)=0;
	kdp.at(0)=0;

	for(long long i=0;i<=mo;i++){
		for(auto a:simen){
			if(i+a<=mo){
				dp.at(i+a)=min(dp.at(i+a),dp.at(i)+1);
			}
		}
		for(auto a:kisu){
			if(i+a<=mo){
				kdp.at(i+a)=min(kdp.at(i+a),kdp.at(i)+1);
			}
		}
	}

	long long n;
	cin>>n;
	while(n>0){
		cout<<dp.at(n)<<" "<<kdp.at(n)<<endl;
		cin>>n;
	}

	return 0;
}

long long modpow(long long n,long long p,long long mod){
	if(p==0) return 1;
	if(p%2==0) return (modpow(n,p/2,mod)*modpow(n,p/2,mod))%mod;
	if(p%2==1) return (modpow(n,p-1,mod)*n)%mod;
	cerr<<"ERROR"<<endl;
	return 1;
}



Measured memory_bytes: 18196
#include <climits>
#include <iostream>
#include <algorithm>
using namespace std;

typedef unsigned long long ull;
static const int MAX_N = 100010;

int main()
{
  int N, K;
  int A[MAX_N];
  cin >> N >> K;

  for (int i = 0; i < N; ++i)
  {
    cin >> A[i];
  }

  ull DP[MAX_N];
  for (int i = 0; i < N; ++i)
  {
    DP[i] = ULLONG_MAX;
  }
  DP[0] = 0;

  for (int i = 0; i < N - 1; ++i)
  {
    for (int j = 1; j <= K; ++j)
    {
      if (i + j >= N) break;

      DP[i + j] = min(DP[i + j], DP[i] + abs(A[i] - A[i + j]));
    }
  }

  cout << DP[N - 1] << endl;

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
void print() {
    cout << endl;
}
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail) != 0)
        cout << " ";
    print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
    for (auto &a : vec) {
        cout << a;
        if (&a != &vec.back())
            cout << " ";
    }
    cout << endl;
}
template <class T>
void print(vector<vector<T>> &df) {
    for (auto &vec : df) {
        print(vec);
    }
}
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define xrep(i, a, b) for (int i = int(a); i < int(b); ++i)
using ll = long long;
const int INF = 1001001001;

int main() {
    int N, A, B;
    cin >> N >> A >> B;
    int minv = min(N*A, B);
    print(minv);

    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
void solve() {
    ll N;
  ll M;
  cin >>N>>M;
  int ac=0;
  int wa=0;
  int WA[100050];
  bool AC[100050];
  rep(i,N) {
    WA[i]=0;
    AC[i]=false;
  }
  
  
  while(M--) {
    ll p;
    string S;
    cin >>p>>S;
    if(AC[p])  {
      continue;
    }
    
    if(S=="AC") {
      AC[p]=true;
      ac++;
      wa+=WA[p];
    }
    
    else if (S=="WA") {
   WA[p]++;
    }
  }
  
  
  cout<<ac<<" "<<wa<<endl;
  return;
}
    
  
  
  











int main() {
 solve();
}


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

using namespace std;

vector<pair<int, int> > sp; 
vector<pair<pair<int, int>, int> > ans; 
int l, last;
vector<pair<int, int> > adj[50];

void solve(int now, int l)
{
	if(l==0)
	{
		last=now;
		return;
	}
	if(l%2==1)
	{
		adj[now].push_back({now+1, (l+1)/2});
		adj[now].push_back({now+1, 0});
		solve(now+1, l/2);
	}
	else
	{
		adj[now].push_back({now+1, (l/2)+1});
		adj[now].push_back({now+1, 0});
		solve(now+1, (l/2-1));
		sp.push_back({now, l/2});
	}
}

signed main()
{
	cin>>l;
	l--;
	solve(1, l);
	for(auto i:sp)
	{
		adj[i.first].push_back({last, i.second});
	}
	for(int i=1; i<=last; i++)
	{
		for(auto j:adj[i])
		{
			ans.push_back({{i, j.first}, j.second});
		}
	}
	cout<<last<<" "<<ans.size()<<endl;
	for(auto i:ans)
	{
		cout<<i.first.first<<" "<<i.first.second<<" "<<i.second<<endl;
	}
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n

def cnt_rem(ans, x):
    i = 2
    ret = 0
    while (x + 1) * i <= n:
        ret += ans[(x + 1) * i - 1]
        i += 1
    
    return ret % 2

for i in range(n - 1, -1, -1):
    cnt = cnt_rem(ans, i)
    if cnt != a[i]:
        ans[i] += 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1, end = " ")

Measured memory_bytes: 12236
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define erep(i,N) for(int i = N - 1; i >= 0; i--)
const ll INF = 1000000000;
//const ll MOD = 1000000007;
const ld PI = (acos(-1));
using Graph = vector<vector<int>>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true;} return false;}
typedef pair<int, int> P;
typedef pair<ll,ll> PLL;
double rad(double a) {return a * 180 / PI;}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

//dpTable
//int dp[100050];

int main(){
    int N;
    cin >> N;
    vector<ll> T(N);
    rep (i,N) cin >> T.at(i);
    ll ans = 1;
    for (int i = 0; i < N; i++){
        ans = ans / __gcd(ans,T.at(i)) * T.at(i);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que) priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int>> Matrix;
const int MOD = 1e9 + 7;
const int MAX = 1e7;
const int INF = numeric_limits<int>::max();
const long double EPS =1e-9;



int main(){
    int k,n,s=0,res=0; cin>>k>>n;
    int a[n];
int m_dis=0,dis;
    REP(i,n){
        cin>>a[i];
        if(i!=0){
            dis=a[i]-a[i-1];
        if(dis>m_dis){
            m_dis=dis;
            s=i;
        }
        }
    }
    
    if(a[0]+k-a[n-1]>m_dis){
            m_dis=a[0]+k-a[n-1];
            s=0;
        }

    res=k-m_dis;
    cout<<res<<endl;
}

  

Measured memory_bytes: 1024
using AtCoderBeginnerContest159.Questions;
using AtCoderBeginnerContest159.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest159.Questions
{
    public class QuestionC : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var l = inputStream.ReadDouble();

            var v = Math.Pow(l / 3, 3);
            yield return v;
        }
    }
}


namespace AtCoderBeginnerContest159
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionC();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest159.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest159.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

int main(){
  double W,H,x,y;
  cin >> W >> H >> x >> y;
  double ans=W/2.0*H;
  int f;
  if(W/x==2.0 and H/y==2.0) f=1;
  else f=0;
  cout << ans << " " << f << endl;
  return 0;
}


Measured memory_bytes: 256